Progress
Programming
Handbook
Enabling and Disabling Menu Items
You can selectively enable and disable menu items in your menus. When an item is enabled, it is a valid selection. However, when an item is disabled, it appears grayed out and it cannot be selected. For example, in the following code, when you select button b1 labeled “Text Mode,” the first three items (which correspond to graphic commands) are disabled; the only item enabled is the Text command. Conversely, when you select button b2 labeled “Graphics Mode,” only the items for the graphic commands are enabled.
NOTE: Thep-menu.p
example produces a run-time warning in character interfaces because it cannot create a dynamic window.p-menu.p
![]()
Note that the items in myfile and mycolors have identical names. Progress allows you to use non-unique names for menu items as long as they belong to different submenus. To avoid ambiguity when you subsequently refer to these items, use the IN MENU clause to identify the parent menu of the item or the IN SUB–MENU clause to identify the parent submenu of the item. The IN MENU or IN SUB–MENU clause is not necessary if the name of the menu item is unique.
When you run this procedure, a window containing a menu bar and two buttons appears. If you choose the Text Mode button and subsequently pull down the Edit menu, you see that only the last item in the menu, Black, is enabled. The rest of the items (Red, Green, and Blue) associated with the Graphics Mode button are grayed out. They are enabled when you select the Graphics Mode button prior to accessing the Edit menu.
NOTE: There are situations where Progress cannot disambiguate a menu item. One is where the same menu item occurs in a submenu that itself is duplicated in two menus, and where the second menu also contains the same menu item. In that case Progress can only reference the menu item in the first copy of the submenu. This is because Progress cannot distinguish the three identical menu items contained in the first and second copies of the submenu and also in the second menu.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |