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

extevent

open

Children

document

menubox

menuitem

menusep

record

transformer

Parent

canvas

checkbox

dialog

edittext

groupbox

image

layoutbox

listbox

menubox

module

notepage

poptext

pushbutton

radiobutton

rectangle

scrollbar

spinbox

splitbox

statictext

tablefield

toolbar

treeview

window

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

.bgc

identifier

color

S,G/D/C

background color

.child[integer]

object

object

S,G/-/C

accesses the I-th child object

.childcount

integer

integer

-,G/-/-

queries the number of child objects

.class

class

class

-,G/-/-

class/id of object

.control

object

control

-,G/-/-

control currently belonging to object

.dialog

identifier

instance

-,G/-/-

dialog to which the object belongs

.document[integer]

object

document

S,G/-/-

accesses the I-th XML Document

.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

.fgc

identifier

color

S,G/D/C

foreground color

.firstchild

object

object

S,G/-/C

accesses the first child object

.firstmenu

identifier

instance

S,G/-/-

first menu of window

.firstrecord

object

record

S,G/-/C

accesses the first record of an object

.font

identifier

font

S,G/D/C

object font

.groupbox

identifier

instance

-,G/-/-

object groupbox

.help

string

identifier

string

text

S,G/D/C

help text of object

.helpmenu

boolean

boolean

-,G/D/C

right-justified menubox

.label

string

string

S,G/D/C

name/identifier of object

.lastchild

object

object

S,G/-/C

accesses the last child object

.lastmenu

identifier

instance

S,G/-/-

last menu of window

.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

.menucount

integer

integer

-,G/D/C

number of menu elements in window

.model

identifier

instance

S,G/D/C

model belonging to object

.notepage

object

object

-,G/-/-

notepage which object currently belongs to

.options[enum]

boolean

boolean

S,G/D/-

special options of object

.order

integer

integer

S,G/D/-

defines the order relative to other menuboxes or menuitems

.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

.title

string

identifier

string

text

S,G/D/C

title of entry

.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

20.2 Specific Attributes

The attribute .options can have the following values:

option_index

Meaning

opt_enable_tearoff

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

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

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";

    }

  }

}

Figure 13-28: Fenster mit Menüleiste

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.

child menubox Pulldown

{

  .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";

    }

  }

}