Common Desktop Environment: Application Builder User's Guide

Connecting Menu Items to Actions

Once you have created a menu and attached it to an object as described in "To Create a Menu" and "To Attach an Existing Menu to an Object", you need to connect a meaningful action to each item in each menu. Choices for target actions are Predefined, Call Function, Execute Code, Activate On-Item Help, and Access Help Volume.

Connecting menu items to the first three types of actions are described below. See "To Connect a Help Menu to On Item Help" and "To Connect a Help Menu to a Help Volume" for instructions for making help connections.

To Connect a Menu Item to a Predefined Action

Only Predefined target actions are described in this section. See "To Connect a Menu Item to a Call Function" and "To Connect a Menu Item to an Execute Code Action" for information about those connections.

  1. Display the Connections Editor.

    Click Connections at the bottom of the Revolving Property Editor or choose Connections from the Editors menu of the App Builder primary window.

  2. Choose Menu Item from the Source menu.

    All of the menu items in the current project will be listed.

  3. Select a menu item from the list below the Source menu.

    This is the item from which the connection will be made.

  4. Choose Predefined as the target action type from the Action Type menu.

    The Target menu will be activated.

  5. Choose the appropriate type of object from the Target menu.

    This is the type of object that will be acted on when the When action is performed on the source menu item.

  6. Select an object in the list of Target items.

    This is the specific object that will be acted on when the When action is performed on the source menu item.

  7. Choose a When action for the Source menu item.

    Choices are Activated, Created, and Destroyed.

  8. Choose a target action from the option menu to the right of Action Type.

    The choices vary depending on the target type.

  9. Click Connect to make the connection.

    The connection will be displayed in the View list at the bottom of the Connections Editor.

  10. Click Cancel to dismiss the Connections Editor.

The designated target action will be performed in the compiled application when the When action is performed on the menu item.

Depending on the source When and target action, you may be able to test the connection in Test mode. See "To Test Menus in a Module" for instructions.

To Connect a Menu Item to a Call Function

Only the Call Function target action is described in this section. See "To Connect a Menu Item to a Predefined Action" and "To Connect a Menu Item to an Execute Code Action" for information about those connections.

  1. Display the Connections Editor.

    Click Connections at the bottom of the Revolving Property Editor or choose Connections from the Editors menu of the App Builder primary window.

  2. Choose Menu Item from the Source menu.

    All of the menu items in the current project will be listed.

  3. Select a menu item from the list below the Source menu.

    This is the item from which the connection will be made.

  4. Choose Call Function as the target action type from the Action Type menu.

    The Function text field will be activated.

  5. Type the name of the function to be called in the Call Function text field.

    This is the function that will be called when the When action is performed on the source menu item. See "Adding User Code to Generated Code" for information about incorporating user code into the generated code.

  6. Choose a When action for the Source menu item.

    Choices are Activated, Created, and Destroyed.

  7. Click Connect to make the connection.

    The connection will be displayed in the View list at the bottom of the Connections Editor.

  8. Click Cancel to dismiss the Connections Editor.

To Connect a Menu Item to an Execute Code Action

Only the Execute Code target action is described in this section. See "To Connect a Menu Item to a Predefined Action" and "To Connect a Menu Item to a Call Function" for information about those connections.

  1. Display the Connections Editor.

    Click Connections at the bottom of the Revolving Property Editor or choose Connections from the Editors menu of the App Builder primary window.

  2. Choose Menu Item from the Source menu.

    All of the menu items in the current project will be listed.

  3. Select a menu item from the list below the Source menu.

    This is the item from which the connection will be made.

  4. Choose a When action for the Source menu item.

    Choices are Activated, Created, and Destroyed.

  5. Choose Execute Code as the target action type from the Action Type menu.

    The Execute Code Editor will be displayed.

  6. Type the code to be executed in the Execute Code Editor.

    The Execute Code Editor will be displayed. Type the code in the editor. See "Adding User Code to Generated Code" for information about incorporating user code into the generated code.

  7. Click OK in the Execute Code Editor to apply the changes and dismiss the editor.

  8. Click Connect in the Connections Editor to make the connection.

    The connection will be displayed in the View list at the bottom of the Connections Editor.

  9. Click Cancel to dismiss the Connections Editor.

The code will be executed in the compiled application when the When action is performed on the menu item.