Baanboard.com

Go Back   Baanboard.com

User login

Frontpage Sponsor

Main

Google search


Poll
For ERP LN feature pack upgrade, what method of install are you using?
Installation Wizard into existing VRC
33%
Installation Wizard into new VRC
39%
Manual into existing VRC
6%
Manual into new VRC
22%
Total votes: 49

Baanboard at LinkedIn


Reference Content

 
gbf.set.menu.item()
By patvdv at 26 Feb 2008 - 21:57


gbf.set.menu.item()

Syntax

long gbf.set.menu.item( long menu.id, const string
menu.text(), const string keystroke(), [ long is.default, long
menu.function.id, long maskbit, long multi.mask, long std.button])

Description

Adds a menu item to the set of menu items under the heading as identified by menu.id, as well as it allows to assign a keystroke combination (such as <Ctrl>+A and so on.) and connect it to a standard GBF button which the GBF does not service itself.

Arguments

menu.id

The menu identification.

menu.text() and keystroke()

Both menu.text and keystroke should be messages. In this case the message is first translated to its actual value. So for example when menu.text is "ttgbfl0006" then this value will be: "File". The reason why messages are preferred over (hard coded) text is that help associated to that message will be called when the context help is asked for for this menu or keystroke. The rest of this section keeps using the menu.text and keystroke as if these are the actual menu texts and keystrokes.

At least menu.text or keystroke must be specified:

  • If the menu.text is "---" (3 minutes) then only a menu separator line is drawn in the menu which can never be selected and will generate a 0 return value. Note that the keystroke should be empty in this case. Also only BW supports these menu separator lines, but no error is generated when using this under BX.
    Note that for these menu separator also the function gbf.set.menu.seperator() should be used.
  • If the menu.text is non empty then the menu.id must be a value returned by a preceding gbf.set.menu.head() call. The keystroke may be empty, in which case no special keystroke recognition is done for this menu item. The keystroke will be added to the menu on the right hand side of the menu entry.
    The first character in the menu.id which is preceded by an "&" will become underscored which allows you to select that menu item by typing that underscored character at the moment the menu is dropped down. This however is not considered to be a keystroke in this manual.
  • If the menu.text is empty, then the keystroke is added to an anonymous menu (menu.id is ignored in this case).

The return value of this function (if > 0) will be the value which is used when the menu is activated or the keystroke is recognized. The GBF does not check whether this keystroke is already in use (when the specified keystroke is not empty), and it is left undetermined which value will be given when the keystroke is recognized, in this ambiguous case.

The format of the keystroke is:

[Ctrl+][Shift+][Alt+](<single char>|F<nr>|<special key>)

where:

Ctrl

indicates that the Control key should be pressed

Shift

indicates that the Shift key should be pressed

Alt

indicates that the Alt key should be pressed

<single char>

is the single character to be pressed

F<nr>

denominates the function key with number <nr>, where 1 <= nr <= 12 on most keyboards.

<special key>

indicates a special key on the keyboard

So to make a Keystroke for <control><shift>F1 use: Ctrl+Shift+F1.

Note that the Shift should only be used for special keys or in combination with other modifiers, for example: Ctrl+F<nr> and Ctrl+Shift+A, not with single characters, as for example GBF cannot differentiate between 'A' and 'Shift+A' (but of course GBF differentiates between 'a' and 'A'). These 'Shift+a' and 'Shift+A' are both converted to "A". In debug mode (see gbf.init(), using GBF.OPT.DEBUG) these changes will be noted with a debug pop-up message.

The supported special keys are:

Special key

Key on keyboard

Needs modifier

Backspace

Backspace

yes

DEL or Delete

DEL or Delete

no

END

END

yes

ESC

ESC or ESCAPE

no

HOME

HOME

yes

INS

INS or Insert

no

PgDn

Page Down

yes

PgUp

Page Up

yes

Return or Enter

Return or Enter

yes

Space

space bar

no

TAB

Tab

no

The last column of the above table tells whether this key can be used by itself, for example ESC, or whether it needs a modifier, for example PgDn, since the standard key is already defined by the GBF. These modifiers are Ctrl, Shift, Alt or any combination of these. The denotations 'Return' and 'Enter' are two different names for the same key.

The is.default argument indicates whether (if the value is true) or not (if the value is false) to use this menu item as the default action. That is when double clicking on a leaf node or selecting and <Enter> (if it could successfully be added) as the default leaf node icon set. The default value is false.

When a menu item is selected or the keystroke is recognized, the following application function will be called by default:

gbf.menu.selected(string object.key, long object.value, long menu.option)

Where menu.option is the return value from the gbf.set.menu.item() function call. For further details about this function see gbf.menu.selected() . When another function has been defined to be called, that function will be called instead, but the arguments will be the same.

 

menu.function.id

The menu.function.id indicates, if > 0, the function to be called when the menu item is selected or keystroke is recognized, instead of the default function. This menu.function.id must be a value returned by a preceding gbf.set.menu.function() call. The default value is 0.

 

maskbit

If the maskbit is used in the menumask of the currently selected item the menu item will be disabled. The default value is 0.

 

multi.mask

The multi.mask is used to indicate what should happen when zero or more than one objects are selected. The lsb is used to indicate whether the menu item should be disabled when no objects are selected. The second bit is used to indicate whether the menu item should be disabled when more than one objects are selected. The default value is GBF.ZERO.ENABLE + GBF.MULTI.ENABLE. The following defines should be used:

GBF.ZERO.ENABLE

menu item is enabled when zero objects are selected

GBF.ZERO.DISABLE

menu item is disabled when zero objects are selected

GBF.MULTI.ENABLE

menu item is enabled when more than one object is selected

GBF.MULTI.DISABLE

menu item is disabled when more than one object is selected

 

std.button

The optional argument std.button should no longer be used. It is only here for compatibility reasons with older versions of the GBF. It is strongly advised to use the new mechanism (see flag standard.button of gbf.init()):

GBF mnemonic

GBF menu text

GBF keystroke

GBF.BUTTON.UNDO

Undo or Redo

Ctrl+Z

GBF.BUTTON.INSERT

Insert

Insert

GBF.BUTTON.COPY

Copy

Ctrl+C

GBF.BUTTON.DELETE

Delete

Delete

GBF.BUTTON.TEXT

Text

Ctrl+T

GBF.BUTTON.GRP.NEW

 

Ctrl+Shift+N

The number of submenus per menu is limited, currently fixed to 10.

Return values

> 1

The identification of this new menu entry

= 1

Should never be returned, as 1 is the GBF default

0

Menu separator line added

GBF.NO.MEMORY

Not enough memory

GBF.MENU.EMPTY

Empty menu text is not allowed

GBF.ILL.MENU.ID

Illegal menu.id value

GBF.ILL.FUNCTION

Illegal menu.function.id value

GBF.ILL.STATE

GBF is not in the right state to deal with this function

GBF.MAX.MENU

Too many submenus for this menu defined

Related topics

0
No votes yet


All times are GMT +2. The time now is 02:56.


©2001-2018 - Baanboard.com - Baanforums.com