Just as this trigger block changes the displayed value for the toggle box called lShowWarehouse when the corresponding menu item is selected, make sure that the initial value of the menu item matches the current value of the toggle box when you drop down the Show menu. There is a MENU-DROP event for submenus (and for pop-up menus) to let you intercept this event and execute whatever code you need before the menu items under the submenu or the pop-up menu are displayed. In this case, you use the event to initialize the CHECKED attribute of the m_Warehouse_Info item to match the toggle box. In other cases, you could use this event to disable menu items that are not currently applicable or even to add additional items to the menu dynamically. You learn how to create dynamic menus and to make changes to menus dynamically later.

This is the MENU-DROP event for the m_Show submenu:

DO:
  MENU-ITEM m_Warehouse_Info:CHECKED IN MENU m_CustWin =
  LOGICAL (lShowWarehouse:SCREEN-VALUE IN FRAME CustQuery).
END.

All the required qualifiers make this statement a bit more complex than it otherwise might be:

  • You have to identify m_Warehouse_Info as a MENU-ITEM.
  • You have to qualify the item as being IN MENU m_CustWin.
  • You have to identify the lShowWarehouse toggle box as being IN FRAME CustQuery.