ClassyTk menu editor
Menus in ClassyTk applications are handled by a
class called DynaMenu. The contents of the
menus are defined by menu definition files in the the
configuration system.
These can be edited more easily using the Menu Editor.
The Menu Editor displays the contents of the menu to be edited in
a tree. New entries of type submenu, action, radio, check or separator
can be added using the Add menu or the toolbar. Entries can be moved
or deleted using the Edit menu or the toolbar.
Options
The following parameters can be changed for an entry
Type
The type can be changed between non menu types. A menu cannot be changed
into another type and vice versa.
Name
This option gives the name of the entry, the text label that is displayed in the menu.
This option is not available separator entries.
Key shortcut
A key shortcut by which the function in the menu can be invoked from a widget
to which the menu is bound. It can either be a Tcl key event
(eg. <Up>, <Alt-a>, <Control-a>, <F2>) or a virtual event
(eg. <<Up>>, <<Print>>).
This option is not available separator entries.
Command (or options)
This option defines the functionality of the entry. The specific
meaning differs acoording to the type of entry. It is not available
for menu and separator entries.
Entry types
menu
This creates a submenu. It has the following parameters:
action
This creates a menu item from which a command can be invoked.
For an action entry, The Command options is the command to be executed when
the entry is invoked.
When the command contains a %W, it will be replaced by the name of the
widget currently associated as a command window (cmdw) to the menu.
separator
This tool takes no parameters, and just creates a separator in a menu.
check
A check entry his is typically used to change a variable to an on or off value.
For a check entry the command option contains a list of options used to create
the check entry. The options for a typical checkbutton would go:
-variable test -onvalue yes -offvalue no -command {puts changed}
When the options contain a %W, it will be replaced by the name of the
widget currently associated as a command window (cmdw) to the menu. This
can eg. be used to bind private variables of an object to the menu entry:
-variable [privatevar %W test] -onvalue yes -offvalue no
The entry can also execute a command using the -command option.
radio
A number radio entries are typically used to change a variable to
one of several values. It can also execute a command.
For radio entries the command option contains a list of option used to create
the radio entry. The options for a typical radiobutton would go:
-variable test -value option1
When the options contain a %W, it will be replaced by the name of the
widget currently associated as a command window (cmdw) to the menu. This
can eg. be used to bind private variables of an object to the menu entry:
-variable [privatevar %W test] test -value option1
activemenu
This creates a submenu that can be changed upon each
invocation. The command will be executed upon each invocation of
the menu. The command should return a menu definition describing the submenu
that should be displayed.