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

activate

changed

deactivate

extevent

help

key

select

Children

document

record

transformer

Parent

menubox

module

window

Menu

none

21.1 Attributes

Attribute

RLD

PID

Properties

Short Description

.accelerator

identifier

accel

S,G/D/C

accelerator of object

.active

boolean

boolean

S,G/D/C

active state of object

.bgc

identifier

color

S,G/D/C

background color

.class

class

class

-,G/-/-

class/id of object

.control

object

control

-,G/-/-

control currently belonging to object

.defbutton

boolean

defbutton

-,G/-/-

mark item bold

.dialog

identifier

instance

-,G/-/-

dialog to which the object belongs

.external

boolean

boolean

-,G/-/-

returns if the object class is an USW class

.external[integer]

class

class

-,G/-/-

returns the I-th registered USW class

.document[integer]

object

document

S,G/-/-

accesses the I-th XML Document

.fgc

identifier

color

S,G/D/C

foreground color

.firstrecord

object

record

S,G/-/C

accesses the first record of an object

.font

identifier

font

S,G/D/C

object font

.function

identifier

func

S,G/D/C

function belonging to object

.groupbox

identifier

instance

-,G/-/-

object groupbox

.help

string

identifier

string

text

S,G/D/C

help text of object

.index

integer

index

integer

index

-,G/-/-

current index of object in the child list of its parent

.label

string

string

S,G/D/C

name/identifier of object

.lastrecord

object

record

S,G/-/C

accesses the last record of an object

.layoutbox

object

object

-,G/-/-

layoutbox of object

.mapped

boolean

boolean

S,G/D/-

defers the display of a visibly created object

.member[integer]

attribute

attribute

-,G/-,-

user-defined attribute [I] of object

.membercount

integer

integer

-,G/-,-

number of user-defined attributes

.model

identifier

instance

S,G/D/C

model belonging to object

.notepage

object

object

-,G/-/-

notepage of object

.options[enum]

boolean

boolean

S,G/D/-

special options of object

.order

integer

integer

S,G/D/-

defines the order relative to other menuitems in a menubox

.parent

identifier

instance

S,G/-/-

parent of object

.real_sensitive

boolean

boolean

-,G/-/-

real selectivity of object

.real_visible

boolean

boolean

-,G/-/-

real visibility of object

.record[integer]

object

record

S,G/-/C

accesses the I-th record of an object

.recordcount

integer

integer

-,G/-/-

queries the number of child records

.scope

integer
(1, 2, 3)

scope

-,G/-/-

queries the object type (Default, Model or instance)

.sensitive

boolean

boolean

S,G/D/C

selectivity of object

.statushelp

string

object

string

text

S,G/-/C

text to be displayed in statusbar

.style

integer

integer

S,G/D/-

kind of display/of behavior

.text

string

identifier

string

text

S,G/D/C

static text of object

.userdata

anyvalue

anyvalue

S,G/D/C

object userdata (any DM datatype)

.visible

boolean

boolean

S,G/D/C

visibility of object

.window

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:

Figure 13-29: Menu