Building a menu programmatically
To build an extended menu programmatically within your presenter code, you need to override the TGUIPresenter functions HandleMenuActivate and HandleMenuDeactivate.
You build the menu within the HandleMenuActivate function. Remember that you only need to build the menu the first time the function is called for a particular document session.
Building a menu programmatically is fairly simple. To build the Tiles menu, you need to:
- Build each item:
- Create a label for the item.
- Instantiate a control state with the appropriate command and a reference to the GUI bundle. The control state mechanism is described in more detail in the next section, "Using a control state to issue commands."
- Create a new TMomentaryMenuItem and have it adopt the label and control state.
- Create a TMenu object containing all the items.
You also need to ensure that your menu items are enabled and disabled as appropriate. The command control state used to build the Tiles menu does this automatically if your commands are implemented correctly, as described in "Enabling and disabling menu items" on page 84.
[Contents]
[Previous]
[Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.
Generated with WebMaker