ResCompiler: Defining Menus
ResCompiler has been superseded. See Converting .brc Files to .arc Format instead.
This section provides the mandatory properties for menu bars, menus, and menu items. Additionally, it provides sample files to illustrate resource file menu definitions.
The Resource Properties Index identifies and describes the optional properties for all resources contained in this section.
Menu bars are either assigned as placeholders for which menus can be created at runtime, or are directly or indirectly defined within the resource file.
Default Menu Bars
The default menu bar serves as a placeholder for which menus can be created at runtime through a standard section of code and is defined as follows:
Menubar Default
Directly- and Indirectly-Defined Menu Bars
The following describes the differences between directly-defined and indirectly-defined menu bars:
-
Definitions for directly-defined menu bars are listed within the nested structure of top-level windows. Directly-defined menu bars do not need menu ID numbers because they cannot be shared with other windows.
-
Definitions for indirectly-defined menu bars consist of two components: a menu bar definition that is a separate top-level resource, and a reference within the nested structure of the top-level window that points to the definition. Indirectly-defined menu bars can be shared with other windows.
Directly-Defined Menu Bars
The following lists the mandatory properties for directly-defined menu bars:
Menubar
Begin
...
End
The following describes the menu bar properties:
|
Property |
Description |
|
Menubar |
Identifies the resource as a menu. Directly-defined menu bars do not require ID numbers. |
Indirectly-Defined Menu Bars
As described above, indirectly-defined menu bar definitions are comprised of two components. The following lists the mandatory properties for the reference component of indirectly-defined menu bars:
Menubar menu-resource-id
The following describes the menu bar properties:
|
Property |
Description |
|
Menubar |
Identifies the resource as a menu bar. |
|
menu-resource-id |
Menu resource ID. |
The following lists the mandatory properties for the definition component of indirectly-defined menu bars:
Menu menu-resource-id
The following describes the menu bar properties:
|
Property |
Description |
|
Menu |
Identifies the resource as a menu bar. |
|
menu-resource-id |
Menu resource ID. |
Example
The following example contains three windows. Window 2 contains a directly-defined menu bar. Window 3 contains an indirectly-defined menu bar. Window 4 contains a default menu bar that is empty and serves as a placeholder.
|
Menus
A menu consists of a list of pull-down command options accessed from the menu bar. The following lists the mandatory properties for menus:
Menu resource-id
Begin
Menu-item menu-id"title" {accelerator-key}
...
End
The following describes the menu properties:
|
Property |
Description |
|
Menu |
Identifies the resource as a menu. (Specified once only.) |
|
resource-id |
Resource ID number. It must be an integer between 1 and 32767. (Specified once only.) |
|
Menu-item |
Identifies the resource as a menu item. (Specified for each menu item.) |
|
menu-id |
Menu ID number. It must be an integer between 1 and 32767. (Specified for each menu item.) |
|
"title" |
Title of the menu item, contained in quotation marks. (Specified for each menu item.) |
|
accelerator-key |
Optional key combination settings that provide quick access to commands. |
Menu items defined between begin and end statements are positioned on the same level. Submenus positioned between begin and end statements are positioned on the next level.
Accelerator Keys
Accelerator keys are key combinations that provide quick access to commands. Although accelerator key settings are optional, they are defined on the mandatory properties line of a menu. To specify the text of the accelerator key, separate the text of the menu item and the accelerator label with a tab character in the title.
Accelerator keys can also be defined by using regular characters enclosed in single quotation marks. The modifiers <Ctrl>,<Alt>, and <Shift> can be used with either method.
|
Key(s) |
Hex Code |
Character Code |
|
Ctrl+f |
$2066$ |
<Ctrl> + 'f' |
|
F1 |
$014B$ or KEY_F1 |
none |
|
<Up Arrow> |
$012D$ or KEY_UP_ARROW |
none |
|
Shift+6 |
$1036$ or $005E$ |
<Shift> + '6' or '^' |
|
Alt+x |
$4078$ |
<Alt> + 'x' |
|
Ctrl+Alt+Shift+6 |
$7036$ or $605E$ |
<Ctrl> + <Alt> + <Shift> + '6' or <Ctrl> + <Alt> + '^' |
The following example defines a menu item with an ID of 10001, a title of "Open", and accelerator keys of Ctrl+O.
Menu-item 10001 "&Open..." "\tCtrl+O" ctrl+'o'
Menu items that are defined between begin and end statements are positioned on the same level. Submenus are positioned on the next level.
Separators
Separators are denoted by the word SEPARATOR where a menu item would be placed.
>