|
DynaMenu
|
Home
Documentation
Screenshots
Binary distributions
Source distribution
subclass of Class
DynaMenu is not a widget and is not intended to produce instances.
It is a class that manages menus in an easy and dynamic way.
Dynamenu can handle several menutypes.
Each menutype is defined by a menu
definition. Dynamenu can create one or more popup or top menus for each
menutype. When the definition of the menutype is redefined
all menus of that type will be changed accordingly.
Menu definitions for menutype are usually controlled from the
Menus part of the configuration
system.
A menu managed by DynaMenu can control several widgets: The commands
associated with the menu can include a %W, that on invocation is
changed to the current cmdw (command widget). The cmdw of a menu can be
changed at any time. DynaMenu also handles key shortcuts.
-
DynaMenu attachmainmenu menutype window ?menuroot?
-
create a top menu of type $menutype and attach it to the given window. $window will
be the initial cmdw for the menu. The menu will be added to the toplevel of $window,
unless menuroot is specified.
-
DynaMenu attachmenu menutype window
-
create a popup menu of type $menutype and attach it to the given window. $window will
be the initial cmdw for the menu.
-
DynaMenu cmdw menutype ?cmdw?
-
change the current cmdw for $menutype to $cmdw. If the cmdw argument is
not given, the method returns the current cmdw for $menutype.
This method is automatically called when a widget which has bindtags
defined by DynaMenu recieves the focus.
-
DynaMenu define menutype ?data?
-
set the definition describing the menus that will be generated
for $menutype to $data. If data is empty, the data for $menutype
will be removed. If data is not given, the current definition for
$menutype will be returned.
-
DynaMenu types
-
returns a list of menutypes managed by Dynamenu
-
DynaMenu delete menutype
-
delete the current definition and all menus of $menutype
-
DynaMenu menu menutype
-
returns the window name of the menu of type $menutype for use in a program.
-
DynaMenu popup menutype ?x y?
-
popup menu of type $menutype
-
DynaMenu invoke curmenu index
-
invoke the item given by $index in $curmenu
-
DynaMenu makemenu menutype menu cmdw bindtag
-
You don't usually have to call this method. The above commands will do. It
creates a menu named $menu of type $menutype if $menu does not exist yet.
$cmdw determines the initial command widget. All key bindings
from key shortcuts
are bound to $bindtag. Adding $bindtag to the bindtags of a widget
will make all shortcuts available from that widget.