summaryrefslogtreecommitdiff
path: root/tix/man/Select.html
blob: d4c9d2b98307b16de7c16381ca0a0f9d06322326 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307



<TITLE>tixSelect - Create and manipulate tixSelect widgets</TITLE>
<Center><H2>tixSelect - Create and manipulate tixSelect widgets</H2></Center><hr>

</pre><H3>SYNOPSIS</H3>
<B>tixSelect<I> <I>pathName ?<I>options</I></B>?
<P>
</pre><H3>SUPER-CLASS</H3>
The <B>TixSelect</B></I> class is derived from the <B>TixLabelWidget</B></I>
class and inherits all the commands, options and
subwidgets of its super-class.
</pre><H3>STANDARD OPTIONS</H3>
The Select widget supports all the standard options of a frame widget.
See the <B>options(n)</B></I> manual entry for details on the standard options.
</pre><H3>WIDGET-SPECIFIC OPTIONS</H3>
<P>
<pre><code><code><code>
Name:		<B>allowZero</B></I>
Class:		<B>AllowZero</B></I>
Switch:		<B>-allowzero</B></I>
</code></code></code></pre>
<UL>
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.

<B>Note</B></I>: When the Select widget is first constructed, the default
selection is always empty, even if <B>-allowzero</B></I> is set to
<B>false</B></I>.
</UL>
<P>
<pre><code><code><code>
Name:		<B>buttonType</B></I>
Class:		<B>ButtonType</B></I>
Switch:		<B>-buttontype</B></I>
</code></code></code></pre>
<UL>
The type of buttons to be used as subwidgets inside the Select widget.
By default, the standard Tk <B>button</B></I> widget class is used.
</UL>
<P>
<pre><code><code><code>
Name:		<B>command</B></I>
Class:		<B>Command</B></I>
Switch:		<B>-command</B></I>
</code></code></code></pre>
<UL>
Specifies the TCL command to be executed when the <B>-value</B></I> 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
<B>-disableCallback</B></I> option is set to false.
</UL>
<P>
<pre><code><code><code>
Name:		<B>disableCallback</B></I>
Class:		<B>DisableCallback</B></I>
Switch:		<B>-disablecallback</B></I>
</code></code></code></pre>
<UL>
A boolean value indicating whether callbacks should be disabled. When
set to true, the TCL command specified by the <B>-command</B></I> option
is not executed when the <B>-value</B></I> of the Select widget
changes.
</UL>
<P>
<pre><code><code><code>
Name:		<B>orientation</B></I>
Class:		<B>Orientation</B></I>
Switch:		<B>-orientation</B></I>
Alias:		<B>-orient</B></I>
</code></code></code></pre>
<UL>
Specifies the orientation of the button subwidgets. Only the values
<B>horizontal</B></I> and <B>vertical</B></I> are recognized. This is a
<I>static option</I></B> and it can only be assigned during the creation of
the widget.
</UL>
<P>
<pre><code><code><code>
Name:		<B>label</B></I>
Class:		<B>Label</B></I>
Switch:		<B>-label</B></I>
</code></code></code></pre>
<UL>
Specifies the string to display as the label of this Select widget.
</UL>
<P>
<pre><code><code><code>
Name:		<B>labelSide</B></I>
Class:		<B>LabelSide</B></I>
Switch:		<B>-labelside</B></I>
</code></code></code></pre>
<UL>
Specifies where the label should be displayed relative to the Select
widget. Valid options are: <B>top</B></I>, <B>left</B></I>, <B>right</B></I>,
<B>bottom</B></I>, <B>none</B></I> or <B>acrosstop</B></I>.
</UL>
<P>
<pre><code><code><code>
Name:		<B>padX</B></I>
Class:		<B>Pad</B></I>
Switch:		<B>-padx</B></I>
</code></code></code></pre>
<UL>
Specifies the horizontal padding between two neighboring button
subwidgets. This is a <I>static option</I></B> and it can only be assigned
during the creation of the widget.
</UL>
<P>
<pre><code><code><code>
Name:		<B>padY</B></I>
Class:		<B>Pad</B></I>
Switch:		<B>-padx</B></I>
</code></code></code></pre>
<UL>
Specifies the vertical padding between two neighboring button
subwidgets. This is a <I>static option</I></B> and it can only be assigned
during the creation of the widget.
</UL>
<P>
<pre><code><code><code>
Name:		<B>radio</B></I>
Class:		<B>Radio</B></I>
Switch:		<B>-radio</B></I>
</code></code></code></pre>
<UL>
A boolean value that specifies whether the Select widget
should act as a radio-box. When set to true, at most one button
subwidget can be selected at any time. This is a <I>static option</I></B>
and it can only be assigned during the creation of the widget.
</UL>
<P>
<pre><code><code><code>
Name:		<B>selectedBg</B></I>
Class:		<B>SelectedBg</B></I>
Switch:		<B>-selectedbg</B></I>
</code></code></code></pre>
<UL>
Specifies the background color of all the selected button subwidgets.
</UL>
<P>
<pre><code><code><code>
Name:		<B>state</B></I>
Class:		<B>State</B></I>
Switch:		<B>-state</B></I>
</code></code></code></pre>
<UL>
Specifies the state of all the buttons inside the Select widget.  Only
the values <B>normal</B></I> and <B>disabled</B></I> are recognized. When the
state is set to <B>disabled</B></I>, all user actions on this Select widget
are ignore.
</UL>
<P>
<pre><code><code><code>
Name:		<B>validateCmd</B></I>
Class:		<B>ValidateCmd</B></I>
Switch:		<B>-validatecmd</B></I>
</code></code></code></pre>
<UL>
Specifies a TCL command to be called when the -value of the
Select widget is about to change. This command is called with
one parameter -- the new <B>-value</B></I> entered by the user. This
command is to validate this new value by returning a value it deems
valid.
</UL>
<P>
<pre><code><code><code>
Name:		<B>value</B></I>
Class:		<B>Value</B></I>
Switch:		<B>-value</B></I>
</code></code></code></pre>
<UL>
The value of a Select widget is a list of the names of the
button subwidgets that have been selected by the user.

When you assign the value of a Select widget using the "config -value"
widget command, the TCL command specified by the <B>-command</B></I>
option will be invoked if some button subwidgets are toggled.
</UL>
<P>
<pre><code><code><code>
Name:		<B>variable</B></I>
Class:		<B>Variable</B></I>
Switch:		<B>-variable</B></I>
</code></code></code></pre>
<UL>
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.
</UL>
</pre><H3>SUBWIDGETS</H3>
<P>
<P>
<pre><code><code><code>
Name:		<B>label</B></I>
Class:		<B>Label</B></I>
</code></code></code></pre>
<UL>
The label subwidget.
</UL>
<P>
In addition, all the button subwidgets created as a result of the
<B>add</B></I> widget command can be accessed by the <B>subwidget</B></I>
command. They are identified by the <I>buttonName</I></B> parameter to the
<B>add</B></I> widget command. Here is an example:
<P>
<pre><code><code><code>
	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
</code></code></code></pre>
</pre><HR>
</pre><H3>DESCRIPTION</H3>
<P>
The <B>tixSelect</B></I> command creates a new window (given by the
<I>pathName</I></B> 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.
</pre><H3>WIDGET COMMANDS</H3>
<P>
The <B>tixSelect</B></I> command creates a new Tcl command whose name is
command may be used to invoke various operations on the widget.  It
has the following general form:
<pre>
<I>pathName option </I></B>?<I>arg arg ...</I></B>?
<P>
</pre>
<I>PathName</I></B> is the name of the command, which is the same as the
determine the exact behavior of the command.  The following commands
are possible for Select widgets:
<DL>
<DT> <I>pathName <B>add<I> buttonName </I></B>?<I>option value ... </I></B>?
</I></B>
<DD> Adds a new button subwidget with the name </B></I>buttonName</B></I> into the
Select widget. Additional configuration options can be given
to configure the new button subwidget.
</DL>
<DL>
<DT> <I>pathName <B>cget<I> <I>option</I></B>
</I></B>
<DD> Returns the current value of the configuration option given by
<I>option</I></B>. <I>Option</I></B> may have any of the values accepted by the
<B>tixSelect</B></I> command.
</DL>
<DL>
<DT> <I>pathName <B>configure</B></I> ?<I>option</I></B>? <I>?value option value ...</I></B>? 
</I></B>
<DD> Query or modify the configuration options of the widget.  If no
<I>option</I></B> is specified, returns a list describing all of the
available options for <I>pathName</I></B> (see <B>Tk_ConfigureInfo</B></I> for
information on the format of this list). If <I>option</I></B> is specified
with no <I>value</I></B>, then the command returns a list describing the
one named option (this list will be identical to the corresponding
sublist of the value returned if no <I>option</I></B> is specified).  If
one or more <I>option-value</I></B> pairs are specified, then the command
modifies the given widget option(s) to have the given value(s); in
this case the command returns an empty string.  <I>Option</I></B> may have
any of the values accepted by the <B>tixSelect</B></I> command.
</DL>
<DL>
<DT> <I>pathName <B>invoke<I> buttonName</I></B>
</I></B>
<DD> Invokes the button subwidget with the name </B></I>buttonName</B></I>.
</DL>
<DL>
<DT> <I>pathName <B>subwidget<I> name ?args?</I></B> 
</I></B>
<DD> When no options are given, returns the pathname of the subwidget of
the specified name.

When options are given, the widget command of the specified subwidget will
be called with these options.
</DL>
</pre><H3>BINDINGS</H3>
<P>
When the user presses the left mouse button over the a button
subwidget, it will be toggled and the <B>-value</B></I> option of the
tixSelect widget will be changed.
</pre><H3>EXAMPLE</H3>
<P>
The following example creates a radio-box style iconbar for the user
to choose one value among <B>eat</B></I>, <B>work</B></I> or <B>sleep</B></I>.
<P>
<pre><code><code><code>
	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]
</code></code></code></pre>
</pre><H3>KEYWORDS</H3>
Tix(n), Container Widget
<hr><i>Last modified Sun Jan 19 22:34:38 EST 1997 </i> --- 
<i>Serial 853731305</i>