Main Menu
Introduction
Main Menus
Main Menus
do have their own module file. They are
independent of form modules. It will be very
useful to look at the code underlying the
default menu used by the Forms Runtime
program. This module was created by Oracle
and it is used as a default main menu. The
source file for this menu is stored in the
FORMS directory in a file named �menudefs.mmb.�
You can easily customized this file or use
it as a basis for a new menu module.
Global
Variable
You can use
Global Variable to shares objects from one
form to another. A Global variable is a
binding variable that can be used by
multiple Form Modules.
NAME_IN and
COPY built-in subprogram
You need to
use the NAME_IN built-in subprogram to read
a value from a global variable or an
indirectly referenced object and the COPY
built-in subprogram to place a value into a
global variable or an indirectly referenced
object.
Always start
with the default created menu,
instead of creating a main menu from
scratch.
Hands-On
Your client
loves what you have done for them. But they
would like you add the same functionality
you did at Hands-On 12 to have it on the
main menu of the �Customer Order�
application.
You have been
assigned to modify the main menu and add
functions from Hands-On 12 to their window's
main menu.
See Figure 15.
Your tasks
are:
1- Modify the
default main menu and add a menu item as
�Data� and a sub-menu item as �Product
Price� on the �Customer Order� Form.
2- Delete some
unused menu items.
3- Pass
product ID as a parameter between these two
Form applications.
4- Run and
test all user functional requirements.
F You
will learn how to: create or modify default
main menu, use and assign global variable
from one form to another, use global
variable to execute query base on its
parameter, create and use the
"WHEN-NEW-FORM-INSTANCE" trigger, use tab
canvas, use �object navigator,� use �Data
Blocks,� use �Layout Editor,� use �Property
Palette,� use �Run Form,� and �Execute
Query.�
Figure 15
Open a Module
In the �Object
Navigator� window, highlight Forms. Go to
the Main menu and choose �File,� select
�Open� to open an existing form (customer_orders_V12)
from the
folder.
Save a Module
Click on the
�CUSTOMER_ORDERS_V12� form. The color
changes to blue. The change its name and
save the Form name as version 13 (customer_orders_v13).
This way the original form is untouched.
We are going
to change the application to invoke the
�Product History Prices Data Entry� FORM
from the application main menu.
Create a Menu
Highlight the
�Menu� item in the "object navigator� and
open the predefined �Oracle default menu�
from the Forms folder. To save your
programming time, you should start with
default menu than you start from scratch.
All menus have extension �mmb.� You can
search for all files that their extension
are �mmb.�
Default Menu
Your default
menu could be on different Oracle
sub-directory version to version. On one
version you may have it in
c:.mmb or
c:ii.mmb ,
etc.
Open the
default menu.
Save a Menu
Save it as "cust_menu"
in the folder. Highlight the menu name and
click again to change the color to blue.
Now, change the menu name to "Cust_menu.�
And open its property palette. Notice that
the name was changed. Then close the window.
Menu Editor
Double click
on the "cust_menu" icon. In the Menu Editor,
the whole menu structure layout will be
displayed. Here you can change the layout
and property of each item in the menu. You
can add, remove, and change the sub-menus.
Menu Editor�s
Toolbar
In the toolbar
of the Menu Editor, you can find very useful
icons. There are the �Create Right� icon,
�Create Down� icon, and �Delete� icon. If
you move your cursor on them, a tooltip will
display their functions.
Next to
sub-menus, you will find the Down Arrow, and
Up Arrow icon. Clicking on the "Up Arrow"
icon collapses each menu list item. Clicking
on the "Down Arrow" icon expands each menu
list item.
Create a
sub-menu
Select the
�Field� sub-menu, and then click on the
"Create Right" icon. That will create a new
sub-menu next to the Field sub-menu. Change
its name to "Data."
Create an item
in a sub-menu
Click on the
"Create Down" icon to create an item under
new sub-menu (Data). Change "new item" to
"Product History Prices," then right click
on it and open its property palette.
This is
another way to change the item name and
other properties. Close the window.
PL/SQL Editor
Right click on
the �Product History Prices� and open the
"PL/SQL Editor."
In the PL/SQL
Editor, write a PL/SQL block to store the
�product id� item into the �global product
id� item and then call the new version of
the �Product Price Data Entry� Form from the
folder.
(PL/SQL
Editor)
:GLOBAL.prodid
:= NAME_IN(�item.prodid�);
OPEN_FORM(�c:_de_v02�);
Compile a
PL/SQL block
Compile and
close the window.
Delete an item
from a Main Menu
To delete an
item, select the item and then click on the
�Delete� icon in the toolbar. When you
delete an item on the menu, you should
confirm your action.
Delete the
�Edit� sub-menu item.
Try to delete
some other sub-menu items if not needed.
Exit Menu
Editor
Close the menu
editor.
Highlight
"cust_menu," save the changes.
Compile a Menu
Then go to
File > Administration > Compile File to
compile the menu. The compile module is
saved in the same folder of its source
module.
Open a Form�s
property palette
Now, go back
to the CUSTOMER_ORDERS_V13 form.
Right click on
the �Customer Orders� Form and open its
Property Palette to assign the new menu.
In the Form
Property Palette, change the �Menu Module�
value to c:_menu. Close the window.
Run the
application
Run the Form.
Notice that
the Main menu was changed. The �Data�
sub-menu was added.
Click on
�Execute query.� Navigate through the
application Form. Highlight a product id,
and then click on the "Product Data Entry�
button.
Close the
window.
Do the same by
using the Main menu option.
You should get
the same result as push button.
Now, close the
windows and save the changes.
�Fathers send their sons to college
either because they went to college
or because they didn't.� L. L.
Henderson |
Questions:
Q: What is a
main menu in the Form Builder?
Q: Are the
main menus independent of form? How?
Q: What is the
default main menu name?
Q: How do you
use NAME_IN and COPY build-in subprogram?
Q: How do you
create a default main menu?
Q: How do you
modify a default main menu?
Q: Your client
loves what you have done for them. But they
would like you add the same functionality
you did at Hands-On 12 to have it on the
main menu of the �Customer Order�
application.
You have been
assigned to modify the main menu and add
functions from Hands-On 12 to their window's
main menu.
See Figure 15.
Your tasks
are:
1- Modify the
default main menu and add a menu item as
�Data� and a sub-menu item as �Product
Price� on the �Customer Order� Form.
2- Delete some
unused menu items.
3- Pass
product ID as a parameter between these two
Form applications.
4- Run and
test all user functional requirements.
|