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
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
|
<HTML>
<HEAD>
<TITLE>iwidgets2.2.0 User Commands - toolbar</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<H1>iwidgets2.2.0 User Commands - toolbar</H1>
<HR>
<PRE>
</PRE>
<H2><HR ALIGN=LEFT WIDTH=70% SIZE=3></H2><PRE>
</PRE>
<H2>NAME</H2><PRE>
<STRONG>toolbar</STRONG> - Create and manipulate a tool bar
</PRE>
<H2>SYNOPSIS</H2><PRE>
<STRONG>toolbar</STRONG> <EM>pathName</EM> ?<EM>options</EM>?
</PRE>
<H2>STANDARD OPTIONS</H2><PRE>
<STRONG>activeBackground</STRONG> <STRONG>font</STRONG> <STRONG>insertForegroundselectForeground</STRONG>
<STRONG>activeForeground</STRONG> <STRONG>foreground</STRONG> <STRONG>orientstate</STRONG>
<STRONG>background</STRONG> <STRONG>highlightBackground</STRONG> <STRONG>relieftroughColor</STRONG>
<STRONG>borderWidth</STRONG> <STRONG>highlightColor</STRONG> <STRONG>selectBackgroundcursor</STRONG>
<STRONG>highlightThickness</STRONG> <STRONG>selectBorderWidthdisabledForegroundinsertBackground</STRONG>
<STRONG>selectColor</STRONG>
See the "options" manual entry for details on the standard
options. For widgets added to the toolbar, these options
will be propogated if the widget supports the option. For
example, all widgets that support a font option will be
changed if the the toolbar's font option is configured.
</PRE>
<H2>WIDGET-SPECIFIC OPTIONS</H2><PRE>
Name: <STRONG>balloonBackground</STRONG>
Class: <STRONG>BalloonBackground</STRONG>
Command-Line Switch: <STRONG>-ballooonbackground</STRONG>
Specifies the background color of the balloon help
displayed at the bottom center of a widget on the tool-
bar that has a non empty string for its balloonStr
option. The default color is yellow.
Name: <STRONG>balloonDelay1</STRONG>
Class: <STRONG>BalloonDelay1</STRONG>
Command-Line Switch: <STRONG>-balloondelay1</STRONG>
Specifies the length of time (in milliseconds) to wait
before initially posting a balloon help hint window.
This delay is in effect whenever 1) the mouse leaves
the toolbar, or 2) a toolbar item is selected with the
mouse button.
Name: <STRONG>balloonDelay2</STRONG>
Class: <STRONG>BalloonDelay2</STRONG>
Command-Line Switch: <STRONG>-balloondelay2</STRONG>
Specifies the length of time (in milliseconds) to wait
before continuing to post balloon help hint windows.
This delay is in effect after the first time a balloon
hint window is activated. It remains in effect until 1)
the mouse leaves the toolbar, or 2) a toolbar item is
selected with the mouse button.
Name: <STRONG>balloonFont</STRONG>
Class: <STRONG>BalloonFont</STRONG>
Command-Line Switch: <STRONG>-balloonfont</STRONG>
Specifies the font of the balloon help text displayed
at the bottom center of a widget on the toolbar that
has a non empty string for its balloonStr option. The
default font is 6x10.
Name: <STRONG>balloonForeground</STRONG>
Class: <STRONG>BalloonForeground</STRONG>
Command-Line Switch: <STRONG>-ballooonforeground</STRONG>
Specifies the foreground color of the balloon help
displayed at the bottom center of a widget on the tool-
bar that has a non empty string for its balloonStr
option. The default color is black.
Name: <STRONG>helpVariable</STRONG>
Class: <STRONG>HelpVariable</STRONG>
Command-Line Switch: <STRONG>-helpvariable</STRONG>
Specifies the global variable to update whenever the
mouse is in motion over a toolbar widget. This global
variable is updated with the current value of the
active widget's helpStr. Other widgets can "watch" this
variable with the trace command, or as is the case with
entry or label widgets, they can set their textVariable
to the same global variable. This allows for a simple
implementation of a help status bar. Whenever the mouse
leaves a menu entry, the helpVariable is set to the
empty string {}.
Name: <STRONG>orient</STRONG>
Class: <STRONG>Orient</STRONG>
Command-Line Switch: <STRONG>-orient</STRONG>
Specifies the orientation of the toolbar. Must be
either horizontal or vertical.
</PRE>
<H2><HR ALIGN=LEFT WIDTH=70% SIZE=3></H2><PRE>
</PRE>
<H2>DESCRIPTION</H2><PRE>
The <STRONG>toolbar</STRONG> command creates a new window (given by the path-
Name argument) and makes it into a <STRONG>toolbar</STRONG> widget. Addi-
tional options, described above may be specified on the com-
mand line or in the option database to configure aspects of
the toolbar such as its colors, font, and orientation. The
<STRONG>toolbar</STRONG> command returns its pathName argument. At the time
this command is invoked, there must not exist a window named
pathName, but pathName's parent must exist.
A <STRONG>toolbar</STRONG> is a widget that displays a collection of widgets
arranged either in a row or a column (depending on the value
of the -orient option). This collection of widgets is usu-
ally for user convenience to give access to a set of com-
mands or settings. Any widget may be placed on a toolbar.
However, command or value-oriented widgets (such as button,
radiobutton, etc.) are usually the most useful kind of widg-
ets to appear on a toolbar.
In addition, the toolbar adds two new options to all widgets
that are added to it. These are the <STRONG>helpStr</STRONG> and <STRONG>balloonStr</STRONG>
options. See the discussion for the widget command add
below.
</PRE>
<H2>WIDGET-SPECIFIC METHODS</H2><PRE>
The toolbar command creates a new Tcl command whose name is
pathName. This command may be used to invoke various opera-
tions on the widget. It has the following general form:
<EM>pathName</EM> <EM>option</EM> ?<EM>arg</EM> <EM>arg</EM> ...?
Option and args determine the exact behavior of the command.
Many of the widget commands for a toolbar take as one argu-
ment an indicator of which widget item of the toolbar to
operate on. The indicator is called an <STRONG>index</STRONG> and may be
specified in any of the following forms:
<EM>number</EM>
Specifies the widget numerically, where 0 corresponds
to the first widget in the notebook, 1 to the second,
and so on. (For horizontal, 0 is the leftmost; for
vertical, 0 is the topmost).
<STRONG>end</STRONG> Specifes the last widget in the toolbar's index. If the
toolbar is empty this will return -1.
<STRONG>last</STRONG> Same as end.
<EM>pattern</EM>
If the index doesn't satisfy any of the above forms,
then this form is used. Pattern is pattern-matched
against the widgetName of each widget in the toolbar,
in order from the first to the last widget, until a
matching entry is found. An exact match must occur.
The following commands are possible for toolbar widgets:
<EM>pathName</EM> <STRONG>add</STRONG> <EM>widgetCommand</EM> <EM>widgetName</EM> ?<EM>option</EM> <EM>value</EM>?
Adds a widget with the command widgetCommand whose name
is widgetName to the toolbar. If widgetCommand is
radiobutton or checkbutton, its packing is slightly
padded to match the geometry of button widgets. In
addition, the indicatorOn option is false by default
and the selectColor is that of the toolbar background
by default. This allows Radiobutton and Checkbutton
widgets to be added as icons by simply setting their
bitmap or image options. If additional arguments are
present, they are the set of available options that the
widget type of <EM>widgetCommand</EM> supports. In addition they
may also be one of the following options:
<STRONG>-helpstr</STRONG> <EM>value</EM>
Specifes the help string to associate with the
widget. When the mouse moves over the widget, the
variable denoted by <STRONG>helpVariable</STRONG> is set to
<STRONG>helpStr</STRONG>. Another widget can bind to the helpVari-
able and thus track status help.
<STRONG>-balloonstr</STRONG> <EM>value</EM>
Specifes the string to display in a balloon window
for this widget. A balloon window is a small popup
window centered at the bottom of the widget. Usu-
ally the <STRONG>balloonStr</STRONG> value is the name of the item
on the toolbar. It is sometimes known as a hint
window.
When the mouse moves into an item on the toolbar,
a timer is set based on the value of <STRONG>balloonDe-</STRONG>
<STRONG>lay1</STRONG>. If the mouse stays inside the item for <STRONG>bal-</STRONG>
<STRONG>loonDelay1</STRONG>, the balloon window will pop up
displaying the <STRONG>balloonStr</STRONG> value. Once the balloon
window is posted, a new timer based on <STRONG>balloonDe-</STRONG>
<STRONG>lay2</STRONG> is set. This is typically a shorter timer. If
the mouse is moved to another item, the window is
unposted and a new window will be posted over the
item if the shorter delay time is satisfied.
While the balloon window is posted, it can also be
unposted if the item is selected. In this case the
timer is reset to <STRONG>balloonDelay1</STRONG>. Whenever the
mouse leaves the toolbar, the timer is also reset
to <STRONG>balloonDelay1</STRONG>.
This window posting/unposting model is the same
model used in the Windows95 environment.
<EM>pathName</EM> <STRONG>cget</STRONG> <EM>option</EM>
Returns the current value of the configuration option
given by <EM>option</EM>.
<EM>pathName</EM> <STRONG>configure</STRONG> ?<EM>option</EM> <EM>value</EM>?
Query or modify the configuration options of the
widget. If no <EM>option</EM> is specified, returns a list
describing all of the available options for pathName
(see Tk_ConfigureInfo for information on the format of
this list). If <EM>option</EM> is specified with no value, then
the command returns a list describing the one named
option (this list will be identical to the correspond-
ing sublist of the value returned if no option is
specified). If one or more option-value 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.
<EM>pathName</EM> <STRONG>delete</STRONG> <EM>index</EM> ?<EM>index2</EM>?
This command deletes all items between <EM>index</EM> and <EM>index2</EM>
inclusive. If <EM>index2</EM> is omitted then it defaults to
<EM>index</EM>. Returns an empty string.
<EM>pathName</EM> <STRONG>index</STRONG> <EM>index</EM>
Returns the widget's numerical index for the entry
corresponding to <EM>index</EM>. If <EM>index</EM> is not found, -1 is
returned.
</PRE>
<H2>value?</H2><PRE>
<EM>pathName</EM> <STRONG>insert</STRONG> <EM>beforeIndex</EM> <EM>widgetCommand</EM> <EM>widgetName</EM> ?<EM>option</EM>
Insert a new item named <EM>widgetName</EM> with the
command <EM>widgetCommand</EM> before the item specified by
<EM>beforeIndex</EM>. If <EM>widgetCommand</EM> is <STRONG>radiobutton</STRONG> or <STRONG>check-</STRONG>
<STRONG>button</STRONG>, its packing is slightly padded to match the
geometry of button widgets. In addition, the <STRONG>indica-</STRONG>
<STRONG>torOn</STRONG> option is <STRONG>false</STRONG> by default and the <STRONG>selectColor</STRONG> is
that of the toolbar background by default. This allows
<STRONG>Radiobutton</STRONG> and <STRONG>Checkbutton</STRONG> widgets to be added as
icons by simply setting their <STRONG>bitmap</STRONG> or <STRONG>image</STRONG> options.
The set of available options is the same as specified
in the <STRONG>ad</STRONG> command.
<EM>pathName</EM> <STRONG>itemcget</STRONG> <EM>index</EM> <EM>option</EM>
Returns the current value of the configuration option
given by <EM>option</EM> for index. The item type of <EM>index</EM>
determines the valid available options.
<EM>pathName</EM> <STRONG>itemconfigure</STRONG> <EM>index</EM> ?<EM>option</EM> <EM>value</EM>?
Query or modify the configuration options of the widget
of the toolbar specified by <EM>index</EM>. If no option is
specified, returns a list describing all of the avail-
able options for <EM>index</EM> (see <STRONG>Tk_ConfigureInfo</STRONG> for infor-
mation on the format of this list). If <EM>option</EM> is speci-
fied with no value, 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 option is specified). If one or more
option-value 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. The item type of <EM>index</EM> determines the valid
available options. The set of available options is the
same as specified in the <STRONG>ad</STRONG> command.
</PRE>
<H2>EXAMPLE</H2><PRE>
toolbar .tb -helpvariable statusVar
.tb add button item1 \
-helpstr "Save It" -bitmap @./icons/Tool_32_box.xbm \
-balloonstr "Save" -command {puts 1}
.tb add button item2 \
-helpstr "Save It" -bitmap @./icons/Tool_32_brush.xbm \
-balloonstr "Save" -command {puts 1}
.tb add button item3 \
-helpstr "Save It" -bitmap @./icons/Tool_32_cut.xbm \
-balloonstr "Save" -command {puts 1}
.tb add button item4 \
-helpstr "Save It" -bitmap @./icons/Tool_32_draw.xbm \
-balloonstr "Save" -command {puts 1}
.tb add button item5 \
-bitmap @./icons/Tool_32_erase.xbm -helpstr "Play It" \
-command {puts 2}
.tb add frame filler \
-borderwidth 1 -width 10 -height 10
.tb add radiobutton item6 \
-bitmap @./icons/Tool_32_oval.xbm -command {puts 4} \
-variable result -value OPEN -helpstr "Radio Button # 1" \
-balloonstr "Radio"
.tb add radiobutton item7 \
-bitmap @./icons/Tool_32_line.xbm -command {puts 5} \
-variable result -value CLOSED
.tb add checkbutton item8 \
-bitmap @./icons/Tool_32_text.xbm -command {puts 6} \
-variable checkit -onvalue yes -offvalue no
.tb add checkbutton check2 \
-bitmap @./icons/Tool_32_points.xbm -command {puts 7} \
-variable checkit2 -onvalue yes -offvalue no
pack .tb -side top -anchor nw
</PRE>
<H2>AUTHOR</H2><PRE>
Bill Scott
</PRE>
<H2>KEYWORDS</H2><PRE>
toolbar, button, radiobutton, checkbutton, iwidgets, widget
</PRE>
</BODY>
</HTML>
|