20 menubox
Most of the objects can be assigned exactly one active menu. Since a menubox is not directly linked to the object as a child, the definition has to be started with menu instead of child. If the menu belongs to a window, this menu must be linked to the window with child.
The actual menu definition then starts with the keyword menubox followed by an identifier. The menuitems, the menu separators, and the menu attributes are defined in braces.
Definition
{ export | reexport } { model } menubox { <Identifier> } { <standard attributes> <layout attributes> <text attributes> <object-specific attributes> }
Events
Children
Parent
Menu
none
Note
window is the only object to which more than one menu can be assigned. This menu has to be linked to the window menu bar with the keyword child.
The menu objects in windows can be defined with the attribute .menu.
With the keyword child, an unspecified number of menuboxes, menuitems and menu separators can be assigned to one menubox.
20.1 Attributes
Attribute |
RLD |
PID |
Properties |
Short Description |
---|---|---|---|---|
identifier |
color |
S,G/D/C |
background color |
|
object |
object |
S,G/-/C |
accesses the I-th child object |
|
integer |
integer |
-,G/-/- |
queries the number of child objects |
|
class |
class |
-,G/-/- |
class/id of object |
|
object |
control |
-,G/-/- |
control currently belonging to object |
|
identifier |
instance |
-,G/-/- |
dialog to which the object belongs |
|
object |
document |
S,G/-/- |
accesses the I-th XML Document |
|
boolean |
boolean |
-,G/-/- |
returns if the object class is an USW class |
|
class |
class |
-,G/-/- |
returns the I-th registered USW class |
|
identifier |
color |
S,G/D/C |
foreground color |
|
object |
object |
S,G/-/C |
accesses the first child object |
|
identifier |
instance |
S,G/-/- |
first menu of window |
|
object |
record |
S,G/-/C |
accesses the first record of an object |
|
identifier |
font |
S,G/D/C |
object font |
|
identifier |
instance |
-,G/-/- |
object groupbox |
|
string identifier |
string text |
S,G/D/C |
help text of object |
|
boolean |
boolean |
-,G/D/C |
right-justified menubox |
|
string |
string |
S,G/D/C |
name/identifier of object |
|
object |
object |
S,G/-/C |
accesses the last child object |
|
identifier |
instance |
S,G/-/- |
last menu of window |
|
object |
record |
S,G/-/C |
accesses the last record of an object |
|
object |
object |
-,G/-/- |
layoutbox of object |
|
boolean |
boolean |
S,G/D/- |
defers the display of a visibly created object |
|
attribute |
attribute |
-,G/-,- |
user-defined attribute [I] of object |
|
integer |
integer |
-,G/-,- |
number of user-defined attributes |
|
integer |
integer |
-,G/D/C |
number of menu elements in window |
|
identifier |
instance |
S,G/D/C |
model belonging to object |
|
object |
object |
-,G/-/- |
notepage which object currently belongs to |
|
boolean |
boolean |
S,G/D/- |
special options of object |
|
integer |
integer |
S,G/D/- |
defines the order relative to other menuboxes or menuitems |
|
identifier |
instance |
S,G/-/- |
parent of object |
|
boolean |
boolean |
-,G/-/- |
real selectivity of object |
|
boolean |
boolean |
-,G/-/- |
real visibility of object |
|
object |
record |
S,G/-/C |
accesses the I-th record of an object |
|
integer |
integer |
-,G/-/- |
queries the number of child records |
|
integer |
scope |
-,G/-/- |
queries the object type (Default, Model or instance) |
|
boolean |
boolean |
S,G/D/C |
selectivity of object |
|
string object |
string text |
S,G/-/C |
text to be displayed in statusbar |
|
string identifier |
string text |
S,G/D/C |
title of entry |
|
anyvalue |
anyvalue |
S,G/D/C |
object userdata (any DM datatype) |
|
boolean |
boolean |
S,G/D/C |
visibility of object |
|
identifier |
instance |
-,G/-/- |
window to which object belongs |
20.2 Specific Attributes
The attribute .options can have the following values:
option_index |
Meaning |
---|---|
You can place this menu as Tearoff menu wherever you like. (on Motif only) |
20.3 Popup-Menus with Microsoft Windows
When a context menu is opened, the object on which the context menu (popup menu) is defined receives the keyboard focus. If this object is a grouping object (for example, a window or groupbox object), then the keyboard focus is set to the first child object that can receive the focus. However, keyboard focus is implemented only if the object on which the context menu is defined or one of the direct or indirect child objects does not already have keyboard focus.
Remarks
- Popup menus under Windows are also opened via the system menu key (Alt key). If you want to open the window menu directly, you should use the F10 key.
20.4 Popup-Menus with Motif
Starting with Motif 2.1, it is standard for pop-up menus with mnemonics to open automatically when a mnemonic character is entered. However, for objects with text input, this behavior can interfere with text input.
As of IDM version A.05.02.f4, for edittexts with a popup menu where mnemonics are defined, the popup menu no longer opens automatically when a mnemonic character is entered.
This makes the edit text behave like other objects with text input. For focusable objects without text input, such as pushbutton, checkbox, radiobutton, image, scrollbar and spinbox with statictext, the popup menu is automatically opened when a mnemonic character is entered.
Remarks
- For all object classes, as of Motif 2.1, the popup menu can be opened by default with the key combination Shift + F10.
- Accelerators can be used as an alternative to mnemonics.
20.5 Example
Window with menu bar and pop-up menu
window Main_window
{
child menubox Menu_1
{
.title "Start Menu";
}
child menubox Menu_2
{
.title "File";
}
child menubox Popup
{
.title "3. Menue";
child menuitem Menu_3
{
.text "Popup 1";
}
child menuitem Menu_4
{
.text "Popup 2";
}
}
}
Note
If a further menu is to be contained in a menu (cascade menu), this menu has to be defined as the child of the first one with the keyword menubox.
{
.title "Edit file";
.sensitive true;
.visible true;
child menuitem Load
{
.text "Load";
.visible true;
}
child menubox Save /* Start cascade menu */
{
.title "Save";
child menuitem As
{
.text "Save as";
}
child menuitem Save
{
.text "With current name";
}
}
}