Try OpenEdge Now
skip to main content
Application Development Environment (ADE) Addenda
Progress Dynamics Addenda : Toolbar and Menu Designer enhancement
 

Toolbar and Menu Designer enhancement

Introduced:

OpenEdge R10.1A
You can now specify an internal procedure that is published just before the creation of a menu item or toolbar button. The Create event field in the Other section of an Item property sheet controls this behavior. The toolbar or menu looks for the procedure in the object specified in the Item link field. If no Item link is specified, the toolbar or menu looks in the container's super procedure.
If you want to create a user-defined list of menu items, you can define the menu items using the defineAction function. For example, if you have a sub-menu called 'Favorites', you can call the defineAction function in the procedure specified in the Create event field to add child items, as shown in the following code:
DYNAMIC-FUNCTION('defineAction' in SOURCE-PROCEDURE,
   ‘Sol',
   'Name,Caption,OnChoose,Parent,Type',
   'Sol'+ CHR(1)+'Solitaire+CHR(1)+'runSolitaire'+ CHR(1)+'Favorites'       +CHR(1) + 'RUN').
If you want to create a user-defined list of menu items that are re-constructed each time the menu is selected (for example, a list of opened windows), you can define a 'Menu drop function' for an item. This is a function located in the linked object defined by the 'Item link' (or container's super if the item link is blank) that returns a CHR(1) delimited list of menu item names and captions.
Suppose you have a sub-menu called 'Modules' that changes with the context of the current record. You can add the following code to the function:
cTarget = DYNAMIC-FUNCTION('linkHandles':U IN TARGET-PROCEDURE,
   'ContainerToolbar-Source':U) NO-ERROR.
   hTarget = WIDGET-HANDLE(cTarget).
   DYNAMIC-FUNCTION("defineAction" IN hToolbar,
      "Favorites",
      "OnChoose",
      "RunFavorites").
cList = "OE,Order Entry,IN,Inventory,CM,Customer Maintenance"
      = REPLACE(cList,",",CHR(1)).
   RETURN cList.
The procedure 'RunFavorites' defined on the parent item 'Favorites' would require a character input parameter. The system would pass the Key (odd entry in the list) to the procedure. (For more information, see the Working with the version 9 ADM: Using and Customizing the SmartToolbar whitepaper.)