Adding a menu bar to a window

To have a menu bar display when a window is opened by a user, you associate a menu with the window in the Window painter.

StepsTo associate a menu with a window:

  1. Click the Open button in the PowerBar, select the window with which you want to associate the menu, and open the window.

  2. Do one of the following:

    • In the Properties view for the window, enter the name of the menu in the MenuName text box on the General tab page.

    • Click the Browse button and select the menu from the Select Object dialog box, which lists all menus available to the application.

      In the Select Object dialog box, you can search for a menu by clicking the Browse button.

  3. Click Save to associate the selected menu with the window.

Identifying menu items in window scripts

You reference menu items in scripts in windows and controls using the following syntax:

menu.menu item

You must always fully qualify the menu item with the name of the menu.

When referring to a menu item in a drop-down or cascading menu, you must specify each menu item on the path to the menu item you are referencing, separating the names with periods.

For example, to refer to the Enabled property of menu item m_open, which is under the menu bar item m_file in the menu saved in the library as m_menu, use:

m_menu.m_file.m_open.Enabled

Changing a window's menu at runtime

You can use the ChangeMenu function in a script to change the menu associated with a window at runtime.