VxMenu --
build a menu, given a menu bar and list of items
Syntax
VxMenuformDialogmenuBarmenuListdefaultCB
Description
Builds a menu, given a menu bar and a list of items.
To create a menu bar on a form dialog, you must specify the form dialog
to place the menu bar on, the widget name of the menu bar, a list of menu
item widgets to place on the menu bar, and a default callback (if no
callbacks are specified for the menu items). Menu item widgets are
buttons; typically, when a button in a menubar is pressed its callback
creates a menu.
Options
formDialog
Sets widgetName of form dialog.
menuBar
Sets widgetName of menubar.
menuList
Sets menu list to build from.
defaultCB
Sets default callback to call if they are not set
in the menuList.
Each item in menuList can contain the following indexes:
0
Type: one of pd, hp, cs, bt,
or sp.
pd
Pulldown
hp
HelpPulldown
cs
CascadeButton
bt
PushButton
sp
Separator
1
Name: name of the button.
2
Mnemonic.
3
Accelerator.
4
acceleratorString of the button.
5
Callback to associate with the button.
6
If the item is a toggle button, this sets the initial state.
For example:
set menuList {
{pd Phone P}
{bt Add A "" "" PhoneMenuAddCB }
{bt Delete D "" "" PhoneMenuDeleteCB }
{sp}
{bt Exit E "" "" PhoneMenuExitCB }
{pd View V}
{bt All A "" "" "" }
{bt Friends F "" "" "" }
{bt Enemies E "" "" "" }
{bt Turkeys T "" "" "" }
}
set menubar [VtMenuBar $form.menubar]
VxMenu $form $menubar $menuList defaultCB
Use VxMenuGetButton to get the reference to a
menu item widget; for example: