1tixSelect(n) Tix Built-In Commands tixSelect(n)
2
3
4
6 tixSelect - Create and manipulate tixSelect widgets
7
9 tixSelect pathName ?options?
10
12 The TixSelect class is derived from the TixLabelWidget class and inher‐
13 its all the commands, options and subwidgets of its super-class.
14
16 The Select widget supports all the standard options of a frame widget.
17 See the options(n) manual entry for details on the standard options.
18
20 [-allowzero allowZero] A boolean value that specifies whether the
21 selection can be empty. When set to false, at least one button subwid‐
22 get must be selected at any time.
23
24 Note: When the Select widget is first constructed, the default selec‐
25 tion is always empty, even if -allowzero is set to false. [-button‐
26 type buttonType] The type of buttons to be used as subwidgets inside
27 the Select widget. By default, the standard Tk button widget class is
28 used. [-command command] Specifies the TCL command to be executed when
29 the -value of the Select widget is changed. This command will be
30 invoked with two arguments. The first is the name of the button subwid‐
31 get that has toggled. The second is a boolean value indicating whether
32 the button subwidget is selected. This command is executed only when
33 the -disableCallback option is set to false. [-disablecallback dis‐
34 ableCallback] A boolean value indicating whether callbacks should be
35 disabled. When set to true, the TCL command specified by the -command
36 option is not executed when the -value of the Select widget changes.
37
38 Name: orientation
39 Class: Orientation
40 Switch: -orientation
41 Alias: -orient
42
43 Specifies the orientation of the button subwidgets. Only the
44 values horizontal and vertical are recognized. This is a static
45 option and it can only be assigned during the creation of the
46 widget. [-label label] Specifies the string to display as the
47 label of this Select widget. [-labelside labelSide] Specifies
48 where the label should be displayed relative to the Select wid‐
49 get. Valid options are: top, left, right, bottom, none or
50 acrosstop. [-padx padX] Specifies the horizontal padding
51 between two neighboring button subwidgets. This is a static
52 option and it can only be assigned during the creation of the
53 widget. [-padx padY] Specifies the vertical padding between two
54 neighboring button subwidgets. This is a static option and it
55 can only be assigned during the creation of the widget.
56 [-radio radio] A boolean value that specifies whether the Select
57 widget should act as a radio-box. When set to true, at most one
58 button subwidget can be selected at any time. This is a static
59 option and it can only be assigned during the creation of the
60 widget. [-selectedbg selectedBg] Specifies the background color
61 of all the selected button subwidgets. [-state state] Specifies
62 the state of all the buttons inside the Select widget. Only the
63 values normal and disabled are recognized. When the state is set
64 to disabled, all user actions on this Select widget are ignore.
65 [-validatecmd validateCmd] Specifies a TCL command to be called
66 when the -value of the Select widget is about to change. This
67 command is called with one parameter -- the new -value entered
68 by the user. This command is to validate this new value by
69 returning a value it deems valid. [-value value] The value of a
70 Select widget is a list of the names of the button subwidgets
71 that have been selected by the user.
72
73 When you assign the value of a Select widget using the "config
74 -value" widget command, the TCL command specified by the -com‐
75 mand option will be invoked if some button subwidgets are tog‐
76 gled. [-variable variable] Specifies the global variable in
77 which the value of the Select widget should be stored. The value
78 of a Select widget is stored as a list of the names of the but‐
79 ton subwidgets that have been selected by the user. The value of
80 the Select widget will be automatically updated when this vari‐
81 able is changed.
82
84 Name: label
85 Class: Label
86
87 The label subwidget.
88
89 In addition, all the button subwidgets created as a result of the add
90 widget command can be accessed by the subwidget command. They are iden‐
91 tified by the buttonName parameter to the add widget command. Here is
92 an example:
93
94 set s [tixSelect .s] pack $s $s add eat -text Eat $s add sleep -text
95 Sleep $s subwidget eat config -fg green $s subwidget sleep config -fg
96 red
97
99 The tixSelect command creates a new window (given by the pathName argu‐
100 ment) and makes it into a Select widget. Additional options, described
101 above, may be specified on the command line or in the option database
102 to configure aspects of the Select widget such as its cursor and
103 relief.
104
105 The Select widget is a container of button subwidgets. It can be used
106 to provide radio-box or check-box style of selection options for the
107 user.
108
110 The tixSelect command creates a new Tcl command whose name is the same
111 as the path name of the Select widget's window. This command may be
112 used to invoke various operations on the widget. It has the following
113 general form:
114 pathName option ?arg arg ...?
115 PathName is the name of the command, which is the same as the Select
116 widget's path name. Option and the args determine the exact behavior of
117 the command. The following commands are possible for Select widgets:
118
119 pathName add buttonName ?option value ... ?
120 Adds a new button subwidget with the name buttonName into the
121 Select widget. Additional configuration options can be given to
122 configure the new button subwidget.
123
124 pathName cget option
125 Returns the current value of the configuration option given by
126 option. Option may have any of the values accepted by the tixSe‐
127 lect command.
128
129 pathName configure ?option? ?value option value ...?
130 Query or modify the configuration options of the widget. If no
131 option is specified, returns a list describing all of the avail‐
132 able options for pathName (see Tk_ConfigureInfo for information
133 on the format of this list). If option is specified with no
134 value, then the command returns a list describing the one named
135 option (this list will be identical to the corresponding sublist
136 of the value returned if no option is specified). If one or
137 more option-value pairs are specified, then the command modifies
138 the given widget option(s) to have the given value(s); in this
139 case the command returns an empty string. Option may have any
140 of the values accepted by the tixSelect command.
141
142 pathName invoke buttonName
143 Invokes the button subwidget with the name buttonName.
144
145 pathName subwidget name ?args?
146 When no options are given, returns the pathname of the subwidget
147 of the specified name.
148
149 When options are given, the widget command of the specified sub‐
150 widget will be called with these options.
151
153 When the user presses the left mouse button over the a button subwid‐
154 get, it will be toggled and the -value option of the tixSelect widget
155 will be changed.
156
158 The following example creates a radio-box style iconbar for the user to
159 choose one value among eat, work or sleep.
160
161 set s [tixSelect .s -radio true -allowzero false] $s add eat -bitmap
162 [tix getbitmap eat] $s add work -bitmap [tix getbitmap work] $s add
163 sleep -bitmap [tix getbitmap sleep]
164
166 Tix(n), Container Widget
167
168
169
170
171
172
173Tix 4.0 tixSelect(n)