NAME

menuItem - Create and manipulate a menu item

SYNOPSIS

menuItem type ?-option optionVal ...?

OPTIONS

-text
(For label and checkButton)
type: percent string
default: ""
-submenu
Widget ID of a menu.
(For label)
type: string
default: ""
-command
Tcl command which is executed if the item is selected

Before evaluating every percent (%) and its following character is substituted in command:
%% by %,
%v by value onValue or offValue dependent on the state of the button,
%w by the widget-ID

(For label and checkButton)
type: string
default: ""
-accelerator
(For label and checkButton)
type: string
default: ""

-icon
Icon of the button. If this parameter is given, even if it is the empty string, gtk_pixmap_menu_item is used, otherwise the normal gtk_menu_item.
(For label)
type: percent string
default: ""
-variable
Name of a (global) variable which is changed if the state of the button changes. If the variable does not exist, it is created with a value of offValue. If it does exist and has the same value than onValue, the checkbutton is selected. If the variable is set externaly (e.g. via the set command) to onValue or offValue, command is called and the state of the widget changed.
(For checkButton)
type: string
default: ""
-onValue
value to store in the item's associated variable whenever this item is selected
(For checkButton)
type: string
default: 1
-offValue
value to store in the item's associated variable whenever this item is not selected
(For checkButton)
type: string
default: 0
-tooltip
Text which is displayed in the appBar of application if the item is activated.
type: string
default: ""

DESCRIPTION

Depending on type a menu item is created. Type must be one of label, checkButton, or separator.

WIDGET COMMANDS

The menuItem command creates a new Tcl command whose name is an ID returned on widget creation. This command may be used to invoke various operations on the widget. It has the following general form:

ID option ?arg arg ...?

option and arg determine the exact behavior of the command. The following commands are possible for menuItem widgets:
ID getValue
Returns value of onValue or offValue depending on the state of the widget.
(For checkButton)
ID setValue value
Sets the state of the widget, changes variable and executes command. value must be either value of onValue or offValue.
(For checkButton)
ID invoke
Does just what would have happened if the user invoked the menuItem with the mouse: for checkButton: toggle the selection state of the button and invoke the Tcl command associated with the checkbutton, if there is one; for label: invoke the Tcl command associated with the label. This command is ignored if the checkbutton's state is not sensitve.
(For checkButton and label)

KEYWORDS


Copyright © 2001 - 2002 P. G. Baum