A menu item which executes a command when
clicked.
Synopsis
gnocl::menuItem [-option value...]
Screenshot
Options
- -text
-
type: percent-string
(default: "")
-
Text or icon of the item.
-
-accelerator
-
type: string
-
Accelerator for this item, like "<Ctrl>A" or
"<Shift><Alt>B".
-
-icon
-
type: string (default: "")
-
Name of the icon TODO.
-
-submenu
-
type: widget-ID
-
Width-ID of a submenu.
-
-onClicked
-
type: string (default: "")
-
Tcl command to be executed if the item is clicked. Before evaluation
the following percent strings are substituted:
%w widget name
-
-sensitive
-
type: boolean (default: 1)
-
Whether or not the item is sensitive to user input.
-
-showImage
-
type: boolean (default: 1)
-
Whether or not to display the specified item image.
- -tooltip
-
type: string
-
Message that appear next to this widget when the mouse pointer is
held over it for a short amount of time.
-
-name
-
type: string
-
Name of the widget, can be used to set options in an rc file.
-
-visible
-
type: boolean (default: 1)
-
Whether or not the item is visible.
Description
A menu item executes a command when clicked. Additionally another
menu can be attached to a menu item, which is automatically show, if
the mouse moves to this item.
Commands
- id delete
-
Deletes the widget and the associated tcl command.
-
id configure [-option
value...]
-
Configures the widget. Option may have any of the values accepted on
creation of the widget.
-
id onClicked
-
Executes the command given by the -onClicked option.
Example
set menu [gnocl::menu \
-title "menuItem"]
$menu add [gnocl::menuItem \
-text "%_Use _Bird" \
-onClicked {puts "use bird"}]
$menu add [gnocl::menuItem \
-text "%_Use _Dog" \
-onClicked {puts "use dog"}]
$menu add [gnocl::menuItem \
-text "%#Quit" \
-onClicked exit]
$menu popup
results in
|