Previous | Table of Contents | Next
Page 392
Figure 14.13.
Testing the WHEN-
WINDOW-ACTIVATED
trigger.
Like a form, a menu is defined by a collection of objects. Some of these objects are
mandatory, and some are optional. Each object may be one of the following:
- Menu
- Object Group
- Program Unit
- Parameter
- Property Class
- Attached Library
- Visual Attribute
You're now going to build a menu for your multi-form application and call it
MAIN_MENU.
To begin with, use the Forms Designer to open
C:\Orawin95\Forms45\Demos\Dfltmenu\menudef by selecting File | Open from the menu (see Figure 14.14). This is the default path to use
if you have installed Developer/2000 on Windows 95. Using the Object Navigator, expand
the Menus object node. If you look at the Properties for
MENUDEF, you'll see a property named Main Menu, which is set to Main_Menu. This property identifies the highest-level menu.
Page 393
Figure 14.14.
Opening the default
menu.
Beneath the Menus object node, you will see the following menus:
- ACTION
- BLOCK
- MAIN_MENU
- EDIT
- FIELD
- HELP
- QUERY
- RECORD
These menus constitute the highest-level menus. However, this is the default menu,
and you'll want to add three high-level menus:
- A menu with items that enable the user to enter data into various tables
- A menu which contains items that enable the user to browse records in the
database but not to modify them
- A menu for invoking reports and graphs
To add the three high-level menus to the default menu, select the Menus object node
with the mouse or arrow keys, and click + on the vertical toolbar. A menu named MENU0
will appear; click the menu until it turns blue and change the name to DATA_ENTRY. Do
the same to create the BROWSE and REPORTS menus (see Figure 14.15). Drag the
three menus below RECORD.
Page 394
Figure 14.15.
Creating new menus.
Although it is difficult to tell by looking at the menus with the Object
Navigator, MAIN_MENU is the highest-level menu.
- Expand the Items object node beneath
MAIN_MENU.
- To add the Data Entry menu to the main menu, select the Items object node
and click + on the vertical toolbar. You will see a new item named ITEM followed by
a number.
- Click on the new item, and rename it as DATA_ENTRY.
- If the properties are not displayed for DATA_ENTRY, right-click Properties,
scroll down to the Command Type property, and change it to Menu (see Figure 14.16).
- Scroll down to the Command Text property, and click the More button at the
top of the Properties window. The Command Text property contains the
command that will be executed when the menu item is selected. A window named
Command Text will appear.
- Enter DATA_ENTRY, and click OK (see Figure 14.17).
- Scroll down to the Label property, and enter
Data Entry. This will be the text that is displayed on the menu bar.
Page 395
Figure 14.16.
Setting the Command
Type property for the
new menu item.
Figure 14.17.
Setting the Command
Text property for the
new menu item.
- If you look at the items that belong to MAIN_MENU, you'll see
that DATA_ENTRY is the first item. This isn't where you want it to appear on
the menu bar.
To move it between EDIT and BLOCK, select DATA_ENTRY with the
mouse, hold down the left mouse button, drag it until the horizontal line appears
below EDIT, and release the left mouse button.
- To incorporate the Browse and Reports menus at the top level of
MAIN_MENU, follow steps 3 through 8. To test the appearance of the menu, double-click the
icon to the left of MENUDEF. Figure 14.18 displays what you should see.
Page 396
Figure 14.18.
Testing the appear-
ance of the menu.
Although you've created three new menus, none of the menus has any items. Let's add
two items to the Data Entry menu.
- Use the Object Navigator to expand the DATA_ENTRY menu (not item
in MAIN_MENU).
- Select the Items object node, and click + on the vertical toolbar.
- In the Properties window, change the name of the item to INSTRUCTOR.
- Scroll down to the Command Type property. As you can see, it is set to
PL/SQL. Don't change it; this is the value that you want.
- Scroll down to the Command Text property and click on More at the top of
the Properties window. The PL/SQL Editor will appear.
- Enter
call_form(`Instructor',NO_HIDE,NO_REPLACE). This PL/SQL
statement invokes the built-in Forms procedure,
call_form, which will display the Instructor form.
- Click Compile and Close.
- In the Properties window, scroll down to the Label property, and enter
Instructor.
You also will need to create an item for the Browse and Reports menu. If you don't, the
Forms Generator will generate an error message when you try to generate an MMX file for the menu.
Page 397
- For the Browse menu, create an item named INSTRUCTOR_BROWSE.
- In the Command Text property for this item, enter the following:
call_form(`Instructor_Browse',NO_HIDE,NO_REPLACE.
- For the Reports menu, create an item named COURSE_CATALOG.
- In the Command Text property for this item, enter
Null; by specifying NULL, the menu item will appear in the menu but it won't perform any actionyet.
In the next lesson, you will learn how to invoke an Oracle Report from a menu item.
Before you go any further, you should rename the menu.
- Select MENUDEF.
- Select File | Save As from the menu.
- Be sure to specify a directory designated for your application as the location
for saving to.
- In the Save As Type field, select Menus
(*.mmb).
- In the File name field, enter
Main_menu.
- Click Save.
When you save a menu in the file system, the file has an extension of
.mmb. However, Forms Runtime can run only an MMX menu file, which is generated from an MMB file. To
generate an MMX file for Main_menu, select File | Administration | Generate from the menu or
press Ctrl+t.
NEW TERM
Up to this point, you have only tested individual forms within the Forms
Designer. Now, you are going to go through the steps of building a multiple-forms
application. The first step is to create a form that will contain the
root window for the application; this window will always display the menu and the console, consisting of the message and
status lines.
- To do this, select File | New | Form from the menu. A new form will appear in
the Object Navigator.
- Change the name of this form to MDI_FRAME.
- Expand the Window object node, select the single window that was
automatically created, and right-click Properties.
- Change the name of the window to ROOT_WINDOW.
Previous | Table of Contents | Next
|
Используются технологии
uCoz