21 menuitem
An unspecified number of menuitems can be defined in a menubox. The keyword for the definition of a menuitem is menuitem followed by an identifier. Object attribute specifications are in braces after that. A menuitem can be defined only as child of a menubox or of a window.
Definition
{ export | reexport } { model } menuitem { <Identifier> }
{
<standard attributes>
<hierarchy attributes>
<layout attributes>
<object-specific attributes>
}
Events
Children
Parent
Menu
none
21.1 Attributes
|
Attribute |
RLD |
PID |
Properties |
Short Description |
|---|---|---|---|---|
|
identifier |
accel |
S,G/D/C |
accelerator of object |
|
|
boolean |
boolean |
S,G/D/C |
active state of object |
|
|
identifier |
color |
S,G/D/C |
background color |
|
|
class |
class |
-,G/-/- |
class/id of object |
|
|
object |
control |
-,G/-/- |
control currently belonging to object |
|
|
boolean |
defbutton |
-,G/-/- |
mark item bold |
|
|
identifier |
instance |
-,G/-/- |
dialog to which the object belongs |
|
|
boolean |
boolean |
-,G/-/- |
returns if the object class is an USW class |
|
|
class |
class |
-,G/-/- |
returns the I-th registered USW class |
|
|
object |
document |
S,G/-/- |
accesses the I-th XML Document |
|
|
identifier |
color |
S,G/D/C |
foreground color |
|
|
object |
record |
S,G/-/C |
accesses the first record of an object |
|
|
identifier |
font |
S,G/D/C |
object font |
|
|
identifier |
func |
S,G/D/C |
function belonging to object |
|
|
identifier |
instance |
-,G/-/- |
object groupbox |
|
|
string identifier |
string text |
S,G/D/C |
help text of object |
|
|
integer index |
integer index |
-,G/-/- |
current index of object in the child list of its parent |
|
|
string |
string |
S,G/D/C |
name/identifier of object |
|
|
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 |
|
|
identifier |
instance |
S,G/D/C |
model belonging to object |
|
|
object |
object |
-,G/-/- |
notepage of object |
|
|
boolean |
boolean |
S,G/D/- |
special options of object |
|
|
integer |
integer |
S,G/D/- |
defines the order relative to other menuitems in a menubox |
|
|
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 |
|
|
integer |
integer |
S,G/D/- |
kind of display/of behavior |
|
|
string identifier |
string text |
S,G/D/C |
static text of object |
|
|
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 |
21.2 Specific Attributes
The attribute .style defines whether a pushbutton, radiobutton or checkbox menu is to be used.
21.3 Differences and special features Qt
The colors of the menu bar in a window are determined by the attributes .menubgc and .menufgc. The colors of the menuitems and sub-menus in pop-up menus as well as in menu bars are determined by .bgc and .fgc of the menubox. This means that the background and foreground color of individual menuitems cannot be changed.
Keyboard navigation behaves differently depending on the UI style. In general, the current entry can always be selected with Enter. With regard to the selection with Space, however, there are differences:
Table 13-2: Behavioral differences of menus in different UI styles
|
UI Style |
Behavior |
|---|---|
|
cleanlooks, plastique, windows |
It is jumped to the first menuitem. No selection happens, the menu remains open. |
|
motif, cde |
A select event is triggered for the current menuitem. The menu will be closed. |
|
gtk+ |
Nothing happens, the menu remains open. |
21.4 Example
two-step menu:
window main_window
{
:
child menubox File
{
.title "file";
.sensitive true;
.visible true;
child menuitem Mi_Open
{
.text "open";
.sensitive true;
.visible true;
}
child menuitem Mi_Save
{
.text "save";
.sensitive true;
.visible true;
}
child menubox Mi_Exit
{
.title "exit";
.sensitive true;
.visible true;
child menuitem SSS_Yes
{
.text "yes";
.sensitive true;
.visible true;
}
child menuitem SSS_No
{
.text "no";
.sensitive true;
.visible true;
}
} /*End menu Cancel*/
} /*End menubox File*/
} /*End window main_window*/
The above example generates the following menu: