Software
Customisation Guide
Menus
:
Defining a Bar Menu Gadget
: Toggle Menus
Toggle Menus
A menu
TOGGLE
field is a menu field with a callback action and a tick-box to show that the field has been selected or unselected.
By default the field will be unselected so the box will not be ticked. When picked the fields callback action will be executed and the tick-box ticked.
If the users picks the field again the callback action will again be executed and the tick removed.
Note that the open callback is an obvious candidate for toggle menus as the
SELECT
or
UNSELECT
action is returned as the second argument to the callback method. Refer to
PML Functions and Methods
.
For example, in the users form definition they can add a toggle field as follows:
layout form !!Myform Dialog size 30 5
. . .
!menu = !this.newmenu(‘Test’, ‘popup’)
!menu.add( 'Toggle' ,’Active/Inactive’, '!this.toggle(‘, 'OnOff' )
. . .
exit
. . .
define method .toggle( !menu IS MENU, !action IS STRING )
!name = !menu.fullname()
!field = !menu.PickedFieldName
$P menu $!name $!action field: $!field
endmethod
Note:
How the user uses the
PickedFieldName
member of the menu object to obtain the last picked field.
If the user picks this menu field the callback method will print:
menu !!MyForm.Menu1 SELECT field: OnOff
1974 to current year.
AVEVA Solutions Limited and its subsidiaries. All rights reserved.