Previous | Table of Contents | Next

Page 427

FIG. 16.18
A new menu module on
the object navigator.




FIG. 16.19
A newly created menu
object.




FIG. 16.20
The Menu Editor used
to layout the menu
options.




In the first block of buttons on the left of the editor are the preceding buttons: cut, copy, paste, copy properties, and paste property tools, respectively. These tools have the same functionality as buttons on other editors that have been discussed.

The middle three tools are the most commonly used on this screen.

The left tool with the downward pointing arrow is the create down tool and is used to create a new menu option below the currently selected option.

Page 428

The middle tool with the right pointing arrow is the create right tool. It creates a new menu option to the right of the currently selected option.

The tool with the red X symbol is the delete option tool, which is used to delete the selected object.

The four tools on the left side of the menu editor are shown above. They are the expand, collapse, expand all, and collapse tools respectively.

Change the label of an option, double-click the option. This will change the color of the label and allow the developer to edit the label.

Figure 16.21 displays the menu editor after the label was changed.

FIG. 16.21
The Menu Editor after
the menu option label
was changed.




Options placed on the menu become items under the menu object on the Object Navigator. Figure 16.22 shows the Employees item on the object navigator.

FIG. 16.22
The Employees option
on the object navigator.




The last step in creating a menu is to add the PL/SQL script to the item. Double-clicking the icon next to the Employees item will open the menu option's PL/SQL editor. The PL/SQL code block can then be entered.

Page 429

Creating and Implementing an Employee System Menu

This section will illustrate the creation of a menu and its subsequent use in an Employee system. You may perform the following steps to create the Employee system menu:

The first step is to create a menu module.

  1. Select the high-level menus module object on the Object Navigator.

  2. Pressing the Create tool will set up a new module. Change the name of the menu module to Empmenu.

  3. Select the Menus child object and click the Create tool. A menu module called Main_menu will appear.

  4. Double-click the icon to the left of the Main_menu object. This will cause the menu editor to open. A "<New Item>" option will appear on the editor.

  5. Change the name of this option to "Employees" by clicking on the item and changing the name.

  6. Click the create down tool twice. This will create two new menu options below the "Employees" option.

  7. Name the first option "Employee Directory" and the second option "Employee Update."

  8. Re-select the "Employees" menu option. Press the create right tool twice. This will create two options to the right of the "Employees" option.

  9. Label the first menu option "Miscellaneous."

  10. Label the second menu option "Exit."

  11. Select the "Miscellaneous" option. Click the create down icon twice.
  12. Label the first option "Department."

  13. Label the second option "Security."

    Figure 16.23 shows the layout after these steps are taken.

FIG. 16.23
The Employee Menu
layout.




  1. The next step is to enter the PL/SQL for each of the items. Figure 16.24 shows the Object Navigator and the newly created menu options.

Page 430

FiG. 16.24
The object navigator and
the Employee menu
options.




    The "Employees" and "Miscellaneous" options do not need PL/SQL. Forms Designer places the PL/SQL into the command text when the option is the first option of a sublist. These types of menu options call another menu option. The developer only needs to populate the items that call a form or execute a subprogram. Table 16.1 lists the menu items that need PL/SQL code and the PL/SQL commands.

Table 16.1Menu Options That Require a PL/SQL Code Block

Menu Item Command
Main_menu Exit exit_form;
Employees_menu Directory call_form (`d:\dirch16.fmx');
Employees_menu Employee_update call_form (d:\empch16a.fmx');
Miscellaneous_menu Department call_form (`d:\depch16.fmx', no_hide);
Miscellaneous_menu Security message (`Not available yet');


  1. Open the Object Navigator.

  2. Double-click the button icon to the left of the each menu item listing in Table 16.1. Enter the command for the table into the displayed PL/SQL editor.

    Figure 16.25 displays the PL/SQL editor and the code block for the "Directory" option.
    After entering the PL/SQL code, the menu is completed.

  3. Generate the menu.
CAUTION
Two common errors occur when developing menus. The first error is failing to generate the menu before using it. When developing a form, the developer does not have to generate the form because Designer usually

Page 431

generates it before executing the form. This is a Designer runtime option. This option does not apply to menus. Because they are never run like a form, there is not automatic generation. It is very common for a developer to make changes, run a form and corresponding menu, only to find the menu changes do not appear.

The second error is to forget to put PL/SQL code blocks in all of the items. The menu will not generate unless each option has code.

FIG. 16.25
The PL/SQL editor and
code block for the
Employee directory
menu option.




A menu must be linked to an application in order to be executed. The menu is linked to a form by means of the form's Menu Module property. This property is located in the form object property sheet. It denotes the name and location of the menu that will be used with the form. Figure 16.26 shows a Form object property sheet. The Menu Module property specifies the menu file used for the form. The form uses the specified file when the Use File property is set to true.

FIG. 16.26
A Form object property
sheet.



Previous | Table of Contents | Next