Simple menus and menu bars
Simple menu convenience methods create row-columns which are configured as simple menu bars or simple menus. These convenience methods are the preferred method of creating a menu system for the following reasons:
• Simple menus are easier to program
• Simple menus use fewer operating system resources on some platforms
• Simple menus are created faster on some platforms
Create a simple menu or menu bar using one of the following simple menu convenience methods:
createSimpleMenuBar:argBlock:
Creates a simple menu bar
createSimplePulldownMenu:argBlock:
Creates a simple pull-down menu
createSimplePopupMenu:argBlock:
Creates a simple pop-up menu
The menu or menu bar is entirely defined by the creation message and resources set in the argBlock. The resources that can be set to define a simple menu or simple menu bar are listed in the following table. The first three resources are arrays whose elements each represent a single menu bar item. These arrays must contain the same number of items, and must describe corresponding items in the same sequence, in order for the menu or menu bar to be correctly defined.
Table 37. Simple Menu and Simple Menu Bar Resources
| | |
buttons | An array of strings specifying the item labels. | String String is ignored for separators, but must be present. |
buttonType | An array of constants specifying the item types. | XmCASCADEBUTTON A cascade button for a submenu Default type for menu bar XmPUSHBUTTON A normal menu item Default type for menu XmSEPARATOR A line separating menu items XmDOUBLESEPARATOR A double line separating items XmRADIOBUTTON A radio-button menu item XmCHECKBUTTON A check-button menu item XmTITLE A title menu item |
buttonMnemonics | An array of characters specifying the item mnemonics. | Character Character is ignored if it is not in the corresponding item string. The code "0 asCharacter" is useful for specifying no mnemonic. |
postFromButton | Only used for pull-down menu creation. An integer specifying the zero-based index of the cascade button specified as the parent of the pull-down menu. | Integer |
Row-columns configured as simple menus or menu bars provide a simple callback that is run whenever any item in a menu is selected. The clientData argument of the callback method is an integer indicating the zero-based position of the selected button in the menu (separators are ignored when determining the button positions).
Tip:
When you add a simple callback to a row-column configured as a simple menu or simple menu bar, the clientData argument is ignored.
Last modified date: 01/29/2015