Adding Operations to Menus

Before adding operations to menu items, save your layout and generate a project.gui file. To generate Java code for your layout, choose GUI -> Save Generate GUI File.

  1. Select the container in the layout window and open the attribute editor for the container(right click in the area outside the grid).
  2. In the Layout window, select a menu item.

    When a menu item is selected, the content of the attribute editor changes to display attributes for a menu item.

  3. Click on the Edit operations button.

    The ID for the menu item is displayed in the labeled bar at the top of the Operations dialog box.

  4. Click on the Insert button to add an operation (GUI builder provides a default name, Opsnumber, for the operation; you can rename the operation by typing a name in the Op Name box).

    Use the Delete button to remove operations from the list. If you accidentally delete operations, you can click Reset to return the list to its state after the last Apply operation. There is no undo operation; you cannot reverse changes you have applied.

  5. Click on the Filter button to set the triggering event, either an event filter or a message filter.

    Filters are described in Filters.

  6. Click the Action button and set the desired response to the trigger by selecting an action type.

    Actions are described in Actions.


As you add more filters and actions, you can test them in the layout window. Custom actions added in the Action dialog box are available only when running the application.

Save the operation settings by clicking OK in the Operations dialog box. When you are ready to test the application, choose GUI -> Save Generate GUI File to create or update the .gui file. Then build the application, and click the Run button in the Java WorkShop toolbar.

See also:

Adding Custom Components and Windows
Adding a Menu Bar and Menus
What Is a Component Operation?