How to Create a New Menu

Top  Previous  Next

Here are the steps for creating a menu starting from an empty window within the Window Designer.

1.

Choose the MENUBAR from the Control Toolbox. Drag the item to the target window.

2.

Right-Click on the Menu, and select Properties from the popup menu.

3.

In the Properties toolbox you will notice a link near the bottom. Click on the Edit Menu link. The Menu Editor dialog appears. Only the MENUBAR statement is present.

You can also simply DOUBLE-CLICK on the Menu to open the Menu Editor.

4.

In the Menu Editor toolbar, press the Menu button (Shift+Insert).

This adds the first MENU statement, its name, and its corresponding END statement, ready for editing.

5.

In the Text field, type the text you want displayed for this MENU.

The ampersand within the menu text signifies that the character following the ampersand is the accelerator key. For example, type &FILE, so the end user sees File.

6.

In the Use field, type a Field Equate Label.

A Field Equate Label has a leading question mark ( ? ), and you should make it descriptive. You refer to the MENU within executable code by its Field Equate Label.

7.

In the Menu Editor toolbar, press the Item button .

This inserts an ITEM between the MENU statement and its END statement. Note that ITEMs are used to execute commands or procedures, whereas MENUs are used to display a selection of other MENUs or ITEMs.

When using the Application Generator, each ITEM you place on a MENU or MENUBAR automatically adds an embed point to the control event handling tree in the Embedded Source dialog. This allows you to easily attach functionality to your ITEMs.

8.

In the Text field, type the text you want to display for this menu ITEM.

For example, type &OPEN, so the end user sees Open. The ampersand within the ITEM name signifies the character following the ampersand is the accelerator key.

9.

In the Use field, type a Field Equate Label.

A Field Equate Label has a leading question mark ( ? ), and you should make it descriptive. For example ?FileOpen shows at a glance the intended purpose of this ITEM: to open a file.

10.

In the Message field, type the MSG attribute contents.

This message text displays in the status bar (if enabled) when the user highlights this MENU or ITEM.

11.

In the HelpID field, type either a help keyword or a context string present in a .HLP file.

If you fill in the HelpID for a MENU or an ITEM, when the user highlights the MENU or ITEM and presses F1, the help file opens to the referenced topic. If more than one topic matches a keyword, the search dialog appears.

A Help keyword is a word or phrase indexed so that the user may search for it in the Help Search dialog. When referencing a context string in the HelpID field, you must identify it with a leading tilde (~).

12.

Right-click on the menu item and select Actions. In the Actions dialog, choose Call a Procedure from the When Pressed drop down list.

The procedure you specify executes when the user selects this ITEM. You may specify parameters to pass and standard file actions (insert, change, delete, or select) if applicable, or you may initiate a new thread. The procedure appears as a "ToDo" item in your Application Tree (unless you named a procedure that already exists).

This is one way to add functionality to your ITEM. You may also add functionality by Run a Program from the drop down list, by embedding source code, or by typing an STD ID in the STD ID field.

After following these steps, you have a single MENU called File, with a single ITEM called Open. To add other ITEMS to the MENU, repeat steps 7 through 12. To add a second MENU, select the END statement and press the Menu button. To add a subMENU, select a MENU or ITEM statement and press the Menu button.

13.

To finish the menu and return to the Window Designer, press the Save and Close button.