TIX(3) | Tix Built-In Commands | TIX(3) |
tixSelect - Create and manipulate tixSelect widgets
tixSelect pathName ?options?
The TixSelect class is derived from the TixLabelWidget class and inherits all the commands, options and subwidgets of its super-class.
The Select widget supports all the standard options of a frame widget. See the options(n) manual entry for details on the standard options.
[-allowzero allowZero] A boolean value that specifies whether the selection can be empty. When set to false, at least one button subwidget must be selected at any time.
Note: When the Select widget is first constructed, the default selection is always empty, even if -allowzero is set to false. [-buttontype buttonType] The type of buttons to be used as subwidgets inside the Select widget. By default, the standard Tk button widget class is used. [-command command] Specifies the TCL command to be executed when the -value of the Select widget is changed. This command will be invoked with two arguments. The first is the name of the button subwidget that has toggled. The second is a boolean value indicating whether the button subwidget is selected. This command is executed only when the -disableCallback option is set to false. [-disablecallback disableCallback] A boolean value indicating whether callbacks should be disabled. When set to true, the TCL command specified by the -command option is not executed when the -value of the Select widget changes.
Name: orientation Class: Orientation Switch: -orientation Alias: -orient
When you assign the value of a Select widget using the "config -value" widget command, the TCL command specified by the -command option will be invoked if some button subwidgets are toggled. [-variable variable] Specifies the global variable in which the value of the Select widget should be stored. The value of a Select widget is stored as a list of the names of the button subwidgets that have been selected by the user. The value of the Select widget will be automatically updated when this variable is changed.
Name: label Class: Label
In addition, all the button subwidgets created as a result of the add widget command can be accessed by the subwidget command. They are identified by the buttonName parameter to the add widget command. Here is an example:
set s [tixSelect .s] pack $s $s add eat -text Eat $s add sleep -text Sleep $s subwidget eat config -fg green $s subwidget sleep config -fg red
The tixSelect command creates a new window (given by the pathName argument) and makes it into a Select widget. Additional options, described above, may be specified on the command line or in the option database to configure aspects of the Select widget such as its cursor and relief.
The Select widget is a container of button subwidgets. It can be used to provide radio-box or check-box style of selection options for the user.
The tixSelect command creates a new Tcl command whose name is the same as the path name of the Select widget's window. This command may be used to invoke various operations on the widget. It has the following general form:
When options are given, the widget command of the specified subwidget will be called with these options.
When the user presses the left mouse button over the a button subwidget, it will be toggled and the -value option of the tixSelect widget will be changed.
The following example creates a radio-box style iconbar for the user to choose one value among eat, work or sleep.
set s [tixSelect .s -radio true -allowzero false] $s add eat -bitmap [tix getbitmap eat] $s add work -bitmap [tix getbitmap work] $s add sleep -bitmap [tix getbitmap sleep]
Tix(n), Container Widget
4.0 | Tix |