The jmenu.tcl library is distributed as part of the jstools package.
This document describes jmenu.tcl version 4.1/4.4.
The menubutton will be labelled with the string associated with key in the current naturallanguage database, and the underline position (if any) in that string will also be taken from the database.
When a menu entry is invoked, its corresponding command procedure will be invoked with w as its sole argument.
There must be a string translation for each command procedure in cmds, or the menu will display only the Tcl name of the command procedure. (The j:command:register procedure aids in ensuring that.)
The accelerator specified in the naturallanguage database, if any, will be displayed to the right of the menu entry text, but that doesn't automatically create an accelerator binding. You should do that explicitly with j:command:bind.
A single hyphen (`-') can appear anywhere in the cmds list, and will produce a separator line in the corresponding position in the menu.
There's currently no way to specify radiobutton entries, cascade submenus, or menu entries with bitmap rather than text labels. However, you can create them with ordinary Tk commands.
This procedure can be invoked either as j:menu:commands or j:menu:command; the two forms function identically, but j:menu:command may read more clearly when you're only adding a single command.
For each entry in list, the text, underline position, and accelerator displayed are looked up based on key in the current naturallanguage string database (as implemented in jldb.tcl), and that entry will be associated with the global variable variable. When variable's value is 1 (true), the checkbutton will be highlighted. Otherwise (typically when variable's value is 0) it won't. Invoking the checkbutton toggles the state of variable.
If `-command command' is specified (and nonnull), then when any of the menu entries is invoked (after toggling the state of variable), command will be executed. Note that command must be a complete Tcl command with all its arguments, and need not be a `command procedure' in the sense required for j:menu:commands.
There must be a string translation for each key in list, or the menu will display only the key itself. (The j:ldb:set_defaults procedure aids in ensuring that, or you can just use keys that will make sense to the user.)
The accelerator specified in the naturallanguage database, if any, will be displayed to the right of the menu entry text, but that doesn't automatically create an accelerator binding. In order to support accelerators, you need to do that explicitly for each entry, e.g. by binding to a procedure that toggles the global variable.
A single hyphen (`-') can appear anywhere in the cmds list, and will produce a separator line in the corresponding position in the menu.
This procedure can be invoked either as j:menu:checkbuttons or j:menu:checkbutton; the two forms function identically, but j:menu:checkbutton may read more clearly when you're only adding a single entry.
For each entry in list, the text, underline position, and accelerator displayed are looked up based on key in the current naturallanguage string database (as implemented in jldb.tcl), and that entry will be associated with the global variable variable. When variable's value is value, the radiobutton will be highlighted. Otherwise it won't. Invoking the radiobutton sets variable to value.
A default global variable to be shared among the entries can be specified with the -command option, as in the first example above, or (possibly) distinct variables can be specified for each entry, as in the second example. If both are specified, the variable in the sublist for a particular entry takes precedence.
If `-command command' is specified (and nonnull), then when any of the menu entries is invoked (after setting the corresponding variable), command will be executed. Note that command must be a complete Tcl command with all its arguments, and need not be a `command procedure' in the sense required for j:menu:commands.
There must be a string translation for each key in list, or the menu will display only the key itself. (The j:ldb:set_defaults procedure aids in ensuring that, or you can just use keys that will make sense to the user.)
The accelerator specified in the naturallanguage database, if any, will be displayed to the right of the menu entry text, but that doesn't automatically create an accelerator binding. In order to support accelerators, you need to do that explicitly for each entry, e.g. by binding to a procedure that sets the global variable.
A single hyphen (`-') can appear anywhere in the cmds list, and will produce a separator line in the corresponding position in the menu.
This procedure can be invoked either as j:menu:radiobuttons or j:menu:radiobutton; the two forms function identically, but j:menu:radiobutton may read more clearly when you're only adding a single entry.
* You can't specify -onvalue or -offvalue options to menu entries created by j:menu:checkbuttons.
* Normal use of these procedures will result in multiple calls to the jldb.tcl procedures to look up the same information, which is a minor performance hit.
* There's no mechanism for providing additional configuration options to the menubutton or the menu created by j:menu:menubutton.
* When
jdoc is embeddable,
j:menu:docs will use the embeddable version rather than starting up a second
process for each document.