.
Eloquence JDLG contact contact


JDLG object and attribute reference:
Menu classes

 
.
  Document revision: 2024-05-27
Refers to JDLG version: 2.0.18


Contents


A Dialog may contain one MenuBar which displays a list of Menu titles. Activating a title opens the corresponding Menu, showing its MenuItems or sub-menus.

A MenuBar is a special container object which accepts Menu or WindowMenu child objects only.

class : string, get
Returns "MenuBar".


A Menu is a special container object which accepts MenuItem or Menu child objects only.

A Menu object may be a child object of a MenuBar, in which case it is a top-level menu, or a child object of another Menu, in which case it is a sub-menu.

In addition, a Menu may be used stand-alone as a context menu.

class : string, get
Returns "Menu".
icon : string, get/set
Specifies the URL referring to an icon image in png, gif or jpg format, to be displayed in the Menu.

If a relative URL is specified, the value of the Application.baseurl or System.baseurl attribute or eloquence.config.baseurl configuration property is prepended.

The default value is empty (icon image not specified).

See also textpos below.

Note: Requires JDLG version 2.0.16 or newer.

id : string, get/set
Note: If the Menu is used in the MenuBar, the "help" id may be set to indicate that this is the Help Menu, which is displayed in the MenuBar at the rightmost position.

Please refer to the common id attribute documentation.

textpos : string, get/set
Specifies the position of the Menu title in relation to an icon image.

Possible values are:
 "left"
 "center"
 "right"
 "top"
 "bottom"

The default textpos value is "right" if an icon image is specified.

Note: If no icon image is specified, the textpos attribute is ignored and the Menu title is left aligned.

Note: Requires JDLG version 2.0.16 or newer.

title : string, get/set
Menu title, to be displayed in the MenuBar. If used as a sub-menu, the title is displayed in the parent Menu.

If an & character occurs in the title, the next character or digit is used to define a corresponding mnemonic key. The menu is then activated when pressing the ALT key along with this mnemonic key.

The default value is empty (no title).

Note: If used as a context menu, the title is ignored.


A MenuItem is a child object of a Menu. When activated, a nonzero rule value is returned to the program.

accelerator : string, get/set
Specifies the accelerator key used to activate the MenuItem, regardless if the Menu is visible or not.

The accelerator key is specified by the corresponding letter or digit, optionally prefixed with one or more modifiers (ctrl, alt, altGraph, meta).

For example:
 "A"
 "ctrl B"
 "ctrl alt 3"
 "alt 4"

In addition, function and action keys may be used, for example:
 "F1", "ctrl F2", "alt F3", ...
 "HOME", "alt END", "INSERT", "ctrl DELETE"

In particular, the Java VK_ key constants may be used. For example, specify "PAGE_DOWN" to use the VK_PAGE_DOWN accelerator key. For details, please refer to the Oracle java.awt.event.KeyEvent documentation.

The default value is empty (no accelerator key).

When set, the accelerator key is symbolically indicated in the title at the rightmost position.

active : integer, get/set
Specifies the state of a checkbox or radiobutton MenuItem.

Zero (default): The checkbox or radiobutton MenuItem is inactive (not checked).

Nonzero: The checkbox or radiobutton MenuItem is active (checked).

activebtn : string, get
If used on a radiobutton MenuItem, returns the path of the active radiobutton MenuItem in the group.

An empty string is returned if there is no active radiobutton MenuItem in the group or if the radiobutton type is not set.

class : string, get
Returns "MenuItem".
icon : string, get/set
Specifies the URL referring to an icon image in png, gif or jpg format, to be displayed in the MenuItem.

If a relative URL is specified, the value of the Application.baseurl or System.baseurl attribute or eloquence.config.baseurl configuration property is prepended.

The default value is empty (icon image not specified).

See also textpos below.

rule : integer, get/set
If nonzero, the rule value is returned to the program, along with the path of the MenuItem object, when the MenuItem is clicked or activated by a mnemonic or accelerator key.

The default rule value is zero.

See also the documentation of the common rule attribute.

textpos : string, get/set
Specifies the position of the MenuItem title in relation to an icon image.

Possible values are:
 "left"
 "center"
 "right"
 "top"
 "bottom"

The default textpos value is "right" if an icon image is specified.

Note: If no icon image is specified, the textpos attribute is ignored and the MenuItem title is left aligned.

title : string, get/set
MenuItem title, to be displayed in the Menu.

If an & character occurs in the title, the next character or digit is used to define a corresponding mnemonic key. The MenuItem is then activated when pressing this mnemonic key while the Menu is visible.

In addition, an accelerator key may be defined, which may be used to activate the MenuItem regardless if the Menu is visible or not.

The default value is empty (no title).

type : string, get/set
Specifies the type of the MenuItem:
"item" (default)  Displays a regular MenuItem.
"separator"  Displays a separator (usually a horizontal line).
"checkbox"  Displays a checkbox MenuItem which maintains an active / inactive (checked / not checked) state. The state may be set or queried through the active attribute.
"radiobutton"  Displays a radiobutton MenuItem which maintains an active / inactive state. The state may be set or queried through the active attribute.

All radiobutton MenuItems located in the same Menu are considered a group, where only one radiobutton MenuItem may be active. When a radiobutton MenuItem is activated, all other radiobutton MenuItems in the same group are deactivated.


WindowMenu is a special Menu class which automatically maintains a list of the currently active sessions.

It may be added to a MenuBar the same way as any other Menu.

For each active session, a MenuItem is automatically generated, displaying the title (caption) of the currently active Dialog.

Activating an entry in the WindowMenu brings the associated session into foreground.

class : string, get
Returns "WindowMenu".
icon : string, get/set
Specifies the URL referring to an icon image in png, gif or jpg format, to be displayed in the WindowMenu.

If a relative URL is specified, the value of the Application.baseurl or System.baseurl attribute or eloquence.config.baseurl configuration property is prepended.

The default value is empty (icon image not specified).

See also textpos below.

Note: Requires JDLG version 2.0.16 or newer.

textpos : string, get/set
Specifies the position of the WindowMenu title in relation to an icon image.

Possible values are:
 "left"
 "center"
 "right"
 "top"
 "bottom"

The default textpos value is "right" if an icon image is specified.

Note: If no icon image is specified, the textpos attribute is ignored and the WindowMenu title is left aligned.

Note: Requires JDLG version 2.0.16 or newer.

title : string, get/set
WindowMenu title, to be displayed in the MenuBar.

If an & character occurs in the title, the next character or digit is used to define a corresponding mnemonic key. The menu is then activated when pressing the ALT key along with this mnemonic key.

The default value is "&Window". ALT+W is the default mnemonic key.


Dialog example
{
   ...

   # A dialog may contain one MenuBar
   MenuBar mb
   {
      # First menu, titled 'File' to meet common conventions
      Menu file
      {
         .title = "&File"

         MenuItem settings
         {
            .title = "&Settings ..."
            .rule = 2001
         }

         MenuItem sep
         {
            .type = "separator"
         }

         MenuItem quit
         {
            .title = "&Quit"
            .accelerator = "ctrl Q"
            .rule = 999
         }
      }

      # Second menu
      Menu application
      {
         .title = "&Application"

         MenuItem customers
         {
            .title = "C&ustomers ..."
            .accelerator = "ctrl U"
            .rule = 2141
         }

         MenuItem orders
         {
            .title = "O&rders ..."
            .accelerator = "ctrl O"
            .rule = 2142
         }

         # Sub menu
         Menu accounting
         {
            .title = "&Accounting"

            MenuItem deposit
            {
               .title = "&Deposit"
               .accelerator = "ctrl D"
               .rule = 2151
            }

            MenuItem withdrawal
            {
               .title = "&Withdrawal"
               .accelerator = "ctrl W"
               .rule = 2152
            }
         }
      }

      # Window menu (list of currently active sessions)
      WindowMenu window
      {
         # (using default attribute values)
      }


      # Help menu
      # Note: The 'help' id causes it to appear at the rightmost position
      Menu help
      {
         .title = "&Help"

         MenuItem index
         {
            .title = "&Index ..."
            .accelerator = "ctrl H"
            .rule = 2501
         }

         MenuItem sep
         {
            .type = "separator"
         }

         MenuItem about
         {
            .title = "&About ..."
            .rule = 2502
         }
      }
   }
}


 
 
 
  Privacy | Webmaster | Terms of use | Impressum Revision: 2024-05-27  
  Copyright © 1995-2024 Marxmeier Software AG