Enabling the Menu

The Screen Designer lets you create multiple menus for a screen. You determine whether the menu appears as a menu bar at the top of the screen or as a right-click pop-up menu. Note that while a screen can have only one menu bar (or main menu), you can assign pop-up menus to any control on the screen that is not a display-only control. So your might assign one menu bar and one pop-up menu for your screen, then have additional pop-up menus associated with a grid control and an entry field that appear on the screen. You can also assign the same pop-up menu to multiple screens or controls.

To add a menu bar (main menu) to your screen:

  1. Select the Menu icon on the screen form.
  2. In the Property window, make sure that the menu’s Style property is set to Static Menu.

    Make a note of the Handle Variable property associated with the menu.

  3. Select the screen form in the Screen Designer.
  4. In the Property window, scroll to the Main Menu property.
  5. Click in the Value field and expand the drop-down list, then select the handle of the menu that you want to use as your screen’s main menu.

When you select a MAIN MENU handle, the generated code causes this menu to display at the top of your window. The code is put into the .cbl program generated. For example, if a screen is called form1 and the static menu handle is FORM1-MN-1-MENU, the code in form1.cbl is:

    PERFORM BUILD-Form1-MN-1-MENU. 

This code generates form1.mnu, which contains:

    CALL "w$menu" USING WMENU-SHOW, MENU-HANDLE.

Pop-up menus do not display via calls to W$MENU like this. They show up automatically when you right-click the control. The code that is generated for the pop-up menu is just a single line of code in the form1.prd file, as follows:

    MOVE menu-handle TO Form1-MN-2-Handle

To define a pop-up menu for use with a screen or control, do the following:

  1. Select the Menu icon on the screen form.
  2. In the Property window, make sure that the menu’s Style property is set to Pop-Up Menu.

    Make a note of the Handle Variable property associated with the menu.

  3. Select the screen form or screen element in the Screen Designer.
  4. . In the Property window, scroll to the Pop-Up Menu property.
  5. Click in the Value field and expand the drop-down list, then select the handle of the menu that you want to use as a pop-up menu.