optionMenu

Name

optionMenu -- A widget with which one of several alternatives can be chosen. (DEPRECATED since GTK+ 2.4)

Synopsis

optionMenu [-option value...]

Screenshot

Options

-data

type: string

User defined data which can be retrieved via the cget subcommand.

-hasFocus

type: 1

This sets the focus to the widget. To unset the focus it must be set to another widet.

-items

type: list of strings (default: "")

Creates for each element of this list a new item. The string value of the element is used as text and value of the item.

-itemList

type: list of two-element-lists

Creates for each element of this list a new item. The first element of each element is used as text and the second element is used as value of the item. (TODO: pixmap for each item)

-name

type: string

Name of the widget, can be used to set options in an rc file.

-onChanged

type: string (default: "")

Tcl command which is executed if the value of the option menu is changed via the GUI. Before evaluation the following percent strings are substituted: TABLE %% | % %w | widget name. %v | value of the active item TABLE This command is not called if the value is changed via the option -value.

-onShowHelp

type: string (default: "")

Tcl command which is executed in the global scope if the "show-help" signal is recieved, which is normally the case if the user presses F1 or Ctrl-F1. Before evaluation the following percent strings are substituated TABLE %% | % %w | widget name %h | help type: either "whatsThis" or "tooltip" TABLE

-onPopupMenu

type: string (default: "")

Tcl command which is executed if the "popup-menu" signal is recieved, which is normally the case if the user presses Shift-F10. Before evaluation the following percent strings are substituated: %w by widget name.

-onRealize

type: string (default: "")

Tcl command whih is executed in the global scope if the widget has been realized. Before evaluation the following percent strings are substituated: TABLE %% | % %w | widget name. TABLE

-sensitive

type: boolean (default: 1)

Whether or not the item is sensitve to user input.

-tooltip

type: string

Message that appear next to this widget when the mouse pointer is held over it for a short amount of time.

-value

type: string

Value of the item which shall be activated

-variable

type: string (default: "")

Name of a (global) variable which is changed whenever the option menu is changed.

-visible

type: boolean (default: 1)

Whether or not the item is visible.

Description

An option menu allows to choose from different possibilities. This widget is deprecated since GTK+ 2.4 Use comboBox instead.

Commands

id cget option

Returns the value for one option. The option may have any of the values accepted by configure.

id configure [-option value...]

Configures the widget. Option may have any of the values accepted on creation of the widget.

id delete

Deletes the widget and the associated tcl command.

id onChanged

Executes the command given by the -onChanged option.

Example

set opt [gnocl::optionMenu -itemValueList [list {"One" "1"} {"One One" "1 1"} {"Eleven" "eleven"}] -onChanged {puts "%v"}]
gnocl::window -title "Option Menu" -child $opt

results in

See also

combo, radioButton, GtkOptionMenu