If you want to use the cpConstructor tool to create menus, you need to:
- Construct your menu using the cpConstructor tool and save your menu to an archive associated with your program
- Implement the presenter for your program so that it reconstructs the menu from the archive and handles the action generated by each menu item
As described earlier, when you create a menu using the cpConstructor tool, you associate an action with each menu item. An action is basically a message that represents a particular operation, for example, "change selected tile to red." When the user selects a menu item, an action is generated and sent to an action handler that knows how to process that action to initiate the associated operation.
This mechanism is provided by the Action framework, one of the GUI Application frameworks. The Action framework allows you to design portions of your program independently, because it allows objects, such as menu items, to send out actions without needing to know anything about the receiver of the action. Likewise, you create a receiver for the action--often the document presenter--that knows how to handle the action but doesn't need to know anything about the sender of the action.
You specify the action associated with the menu item when you build the item in the cpConstructor tool, as described in the section, "Using the cpConstructor tool" on page 86." You create a receiver for the action within the code for your program, as described in "Handling actions" on page 88.
[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