| 1 |
578 |
markom |
<HTML>
|
| 2 |
|
|
<HEAD>
|
| 3 |
|
|
<TITLE>iwidgets2.2.0 User Commands - toolbar</TITLE>
|
| 4 |
|
|
</HEAD>
|
| 5 |
|
|
<BODY BGCOLOR="#FFFFFF">
|
| 6 |
|
|
<H1>iwidgets2.2.0 User Commands - toolbar</H1>
|
| 7 |
|
|
<HR>
|
| 8 |
|
|
<PRE>
|
| 9 |
|
|
|
| 10 |
|
|
</PRE>
|
| 11 |
|
|
<H2><HR ALIGN=LEFT WIDTH=70% SIZE=3></H2><PRE>
|
| 12 |
|
|
|
| 13 |
|
|
|
| 14 |
|
|
</PRE>
|
| 15 |
|
|
<H2>NAME</H2><PRE>
|
| 16 |
|
|
<STRONG>toolbar</STRONG> - Create and manipulate a tool bar
|
| 17 |
|
|
|
| 18 |
|
|
|
| 19 |
|
|
</PRE>
|
| 20 |
|
|
<H2>SYNOPSIS</H2><PRE>
|
| 21 |
|
|
<STRONG>toolbar</STRONG> <EM>pathName</EM> ?<EM>options</EM>?
|
| 22 |
|
|
|
| 23 |
|
|
|
| 24 |
|
|
</PRE>
|
| 25 |
|
|
<H2>STANDARD OPTIONS</H2><PRE>
|
| 26 |
|
|
<STRONG>activeBackground</STRONG> <STRONG>font</STRONG> <STRONG>insertForegroundselectForeground</STRONG>
|
| 27 |
|
|
<STRONG>activeForeground</STRONG> <STRONG>foreground</STRONG> <STRONG>orientstate</STRONG>
|
| 28 |
|
|
<STRONG>background</STRONG> <STRONG>highlightBackground</STRONG> <STRONG>relieftroughColor</STRONG>
|
| 29 |
|
|
<STRONG>borderWidth</STRONG> <STRONG>highlightColor</STRONG> <STRONG>selectBackgroundcursor</STRONG>
|
| 30 |
|
|
<STRONG>highlightThickness</STRONG> <STRONG>selectBorderWidthdisabledForegroundinsertBackground</STRONG>
|
| 31 |
|
|
<STRONG>selectColor</STRONG>
|
| 32 |
|
|
|
| 33 |
|
|
See the "options" manual entry for details on the standard
|
| 34 |
|
|
options. For widgets added to the toolbar, these options
|
| 35 |
|
|
will be propogated if the widget supports the option. For
|
| 36 |
|
|
example, all widgets that support a font option will be
|
| 37 |
|
|
changed if the the toolbar's font option is configured.
|
| 38 |
|
|
|
| 39 |
|
|
|
| 40 |
|
|
</PRE>
|
| 41 |
|
|
<H2>WIDGET-SPECIFIC OPTIONS</H2><PRE>
|
| 42 |
|
|
Name: <STRONG>balloonBackground</STRONG>
|
| 43 |
|
|
Class: <STRONG>BalloonBackground</STRONG>
|
| 44 |
|
|
Command-Line Switch: <STRONG>-ballooonbackground</STRONG>
|
| 45 |
|
|
|
| 46 |
|
|
Specifies the background color of the balloon help
|
| 47 |
|
|
displayed at the bottom center of a widget on the tool-
|
| 48 |
|
|
bar that has a non empty string for its balloonStr
|
| 49 |
|
|
option. The default color is yellow.
|
| 50 |
|
|
|
| 51 |
|
|
Name: <STRONG>balloonDelay1</STRONG>
|
| 52 |
|
|
Class: <STRONG>BalloonDelay1</STRONG>
|
| 53 |
|
|
Command-Line Switch: <STRONG>-balloondelay1</STRONG>
|
| 54 |
|
|
|
| 55 |
|
|
Specifies the length of time (in milliseconds) to wait
|
| 56 |
|
|
before initially posting a balloon help hint window.
|
| 57 |
|
|
This delay is in effect whenever 1) the mouse leaves
|
| 58 |
|
|
the toolbar, or 2) a toolbar item is selected with the
|
| 59 |
|
|
mouse button.
|
| 60 |
|
|
|
| 61 |
|
|
Name: <STRONG>balloonDelay2</STRONG>
|
| 62 |
|
|
Class: <STRONG>BalloonDelay2</STRONG>
|
| 63 |
|
|
Command-Line Switch: <STRONG>-balloondelay2</STRONG>
|
| 64 |
|
|
|
| 65 |
|
|
Specifies the length of time (in milliseconds) to wait
|
| 66 |
|
|
before continuing to post balloon help hint windows.
|
| 67 |
|
|
This delay is in effect after the first time a balloon
|
| 68 |
|
|
hint window is activated. It remains in effect until 1)
|
| 69 |
|
|
the mouse leaves the toolbar, or 2) a toolbar item is
|
| 70 |
|
|
selected with the mouse button.
|
| 71 |
|
|
|
| 72 |
|
|
Name: <STRONG>balloonFont</STRONG>
|
| 73 |
|
|
Class: <STRONG>BalloonFont</STRONG>
|
| 74 |
|
|
Command-Line Switch: <STRONG>-balloonfont</STRONG>
|
| 75 |
|
|
|
| 76 |
|
|
Specifies the font of the balloon help text displayed
|
| 77 |
|
|
at the bottom center of a widget on the toolbar that
|
| 78 |
|
|
has a non empty string for its balloonStr option. The
|
| 79 |
|
|
default font is 6x10.
|
| 80 |
|
|
|
| 81 |
|
|
Name: <STRONG>balloonForeground</STRONG>
|
| 82 |
|
|
Class: <STRONG>BalloonForeground</STRONG>
|
| 83 |
|
|
Command-Line Switch: <STRONG>-ballooonforeground</STRONG>
|
| 84 |
|
|
|
| 85 |
|
|
Specifies the foreground color of the balloon help
|
| 86 |
|
|
displayed at the bottom center of a widget on the tool-
|
| 87 |
|
|
bar that has a non empty string for its balloonStr
|
| 88 |
|
|
option. The default color is black.
|
| 89 |
|
|
|
| 90 |
|
|
Name: <STRONG>helpVariable</STRONG>
|
| 91 |
|
|
Class: <STRONG>HelpVariable</STRONG>
|
| 92 |
|
|
Command-Line Switch: <STRONG>-helpvariable</STRONG>
|
| 93 |
|
|
|
| 94 |
|
|
Specifies the global variable to update whenever the
|
| 95 |
|
|
mouse is in motion over a toolbar widget. This global
|
| 96 |
|
|
variable is updated with the current value of the
|
| 97 |
|
|
active widget's helpStr. Other widgets can "watch" this
|
| 98 |
|
|
variable with the trace command, or as is the case with
|
| 99 |
|
|
entry or label widgets, they can set their textVariable
|
| 100 |
|
|
to the same global variable. This allows for a simple
|
| 101 |
|
|
implementation of a help status bar. Whenever the mouse
|
| 102 |
|
|
leaves a menu entry, the helpVariable is set to the
|
| 103 |
|
|
empty string {}.
|
| 104 |
|
|
|
| 105 |
|
|
Name: <STRONG>orient</STRONG>
|
| 106 |
|
|
Class: <STRONG>Orient</STRONG>
|
| 107 |
|
|
Command-Line Switch: <STRONG>-orient</STRONG>
|
| 108 |
|
|
|
| 109 |
|
|
Specifies the orientation of the toolbar. Must be
|
| 110 |
|
|
either horizontal or vertical.
|
| 111 |
|
|
|
| 112 |
|
|
</PRE>
|
| 113 |
|
|
<H2><HR ALIGN=LEFT WIDTH=70% SIZE=3></H2><PRE>
|
| 114 |
|
|
|
| 115 |
|
|
|
| 116 |
|
|
</PRE>
|
| 117 |
|
|
<H2>DESCRIPTION</H2><PRE>
|
| 118 |
|
|
The <STRONG>toolbar</STRONG> command creates a new window (given by the path-
|
| 119 |
|
|
Name argument) and makes it into a <STRONG>toolbar</STRONG> widget. Addi-
|
| 120 |
|
|
tional options, described above may be specified on the com-
|
| 121 |
|
|
mand line or in the option database to configure aspects of
|
| 122 |
|
|
the toolbar such as its colors, font, and orientation. The
|
| 123 |
|
|
<STRONG>toolbar</STRONG> command returns its pathName argument. At the time
|
| 124 |
|
|
this command is invoked, there must not exist a window named
|
| 125 |
|
|
pathName, but pathName's parent must exist.
|
| 126 |
|
|
|
| 127 |
|
|
|
| 128 |
|
|
A <STRONG>toolbar</STRONG> is a widget that displays a collection of widgets
|
| 129 |
|
|
arranged either in a row or a column (depending on the value
|
| 130 |
|
|
of the -orient option). This collection of widgets is usu-
|
| 131 |
|
|
ally for user convenience to give access to a set of com-
|
| 132 |
|
|
mands or settings. Any widget may be placed on a toolbar.
|
| 133 |
|
|
However, command or value-oriented widgets (such as button,
|
| 134 |
|
|
radiobutton, etc.) are usually the most useful kind of widg-
|
| 135 |
|
|
ets to appear on a toolbar.
|
| 136 |
|
|
|
| 137 |
|
|
In addition, the toolbar adds two new options to all widgets
|
| 138 |
|
|
that are added to it. These are the <STRONG>helpStr</STRONG> and <STRONG>balloonStr</STRONG>
|
| 139 |
|
|
options. See the discussion for the widget command add
|
| 140 |
|
|
below.
|
| 141 |
|
|
|
| 142 |
|
|
|
| 143 |
|
|
|
| 144 |
|
|
</PRE>
|
| 145 |
|
|
<H2>WIDGET-SPECIFIC METHODS</H2><PRE>
|
| 146 |
|
|
The toolbar command creates a new Tcl command whose name is
|
| 147 |
|
|
pathName. This command may be used to invoke various opera-
|
| 148 |
|
|
tions on the widget. It has the following general form:
|
| 149 |
|
|
|
| 150 |
|
|
<EM>pathName</EM> <EM>option</EM> ?<EM>arg</EM> <EM>arg</EM> ...?
|
| 151 |
|
|
|
| 152 |
|
|
Option and args determine the exact behavior of the command.
|
| 153 |
|
|
|
| 154 |
|
|
Many of the widget commands for a toolbar take as one argu-
|
| 155 |
|
|
ment an indicator of which widget item of the toolbar to
|
| 156 |
|
|
operate on. The indicator is called an <STRONG>index</STRONG> and may be
|
| 157 |
|
|
specified in any of the following forms:
|
| 158 |
|
|
|
| 159 |
|
|
<EM>number</EM>
|
| 160 |
|
|
Specifies the widget numerically, where 0 corresponds
|
| 161 |
|
|
to the first widget in the notebook, 1 to the second,
|
| 162 |
|
|
and so on. (For horizontal, 0 is the leftmost; for
|
| 163 |
|
|
vertical, 0 is the topmost).
|
| 164 |
|
|
|
| 165 |
|
|
<STRONG>end</STRONG> Specifes the last widget in the toolbar's index. If the
|
| 166 |
|
|
toolbar is empty this will return -1.
|
| 167 |
|
|
|
| 168 |
|
|
<STRONG>last</STRONG> Same as end.
|
| 169 |
|
|
|
| 170 |
|
|
<EM>pattern</EM>
|
| 171 |
|
|
If the index doesn't satisfy any of the above forms,
|
| 172 |
|
|
then this form is used. Pattern is pattern-matched
|
| 173 |
|
|
against the widgetName of each widget in the toolbar,
|
| 174 |
|
|
in order from the first to the last widget, until a
|
| 175 |
|
|
matching entry is found. An exact match must occur.
|
| 176 |
|
|
|
| 177 |
|
|
The following commands are possible for toolbar widgets:
|
| 178 |
|
|
|
| 179 |
|
|
<EM>pathName</EM> <STRONG>add</STRONG> <EM>widgetCommand</EM> <EM>widgetName</EM> ?<EM>option</EM> <EM>value</EM>?
|
| 180 |
|
|
Adds a widget with the command widgetCommand whose name
|
| 181 |
|
|
is widgetName to the toolbar. If widgetCommand is
|
| 182 |
|
|
radiobutton or checkbutton, its packing is slightly
|
| 183 |
|
|
padded to match the geometry of button widgets. In
|
| 184 |
|
|
addition, the indicatorOn option is false by default
|
| 185 |
|
|
and the selectColor is that of the toolbar background
|
| 186 |
|
|
by default. This allows Radiobutton and Checkbutton
|
| 187 |
|
|
widgets to be added as icons by simply setting their
|
| 188 |
|
|
bitmap or image options. If additional arguments are
|
| 189 |
|
|
present, they are the set of available options that the
|
| 190 |
|
|
widget type of <EM>widgetCommand</EM> supports. In addition they
|
| 191 |
|
|
may also be one of the following options:
|
| 192 |
|
|
|
| 193 |
|
|
<STRONG>-helpstr</STRONG> <EM>value</EM>
|
| 194 |
|
|
Specifes the help string to associate with the
|
| 195 |
|
|
widget. When the mouse moves over the widget, the
|
| 196 |
|
|
variable denoted by <STRONG>helpVariable</STRONG> is set to
|
| 197 |
|
|
<STRONG>helpStr</STRONG>. Another widget can bind to the helpVari-
|
| 198 |
|
|
able and thus track status help.
|
| 199 |
|
|
|
| 200 |
|
|
<STRONG>-balloonstr</STRONG> <EM>value</EM>
|
| 201 |
|
|
Specifes the string to display in a balloon window
|
| 202 |
|
|
for this widget. A balloon window is a small popup
|
| 203 |
|
|
window centered at the bottom of the widget. Usu-
|
| 204 |
|
|
ally the <STRONG>balloonStr</STRONG> value is the name of the item
|
| 205 |
|
|
on the toolbar. It is sometimes known as a hint
|
| 206 |
|
|
window.
|
| 207 |
|
|
|
| 208 |
|
|
When the mouse moves into an item on the toolbar,
|
| 209 |
|
|
a timer is set based on the value of <STRONG>balloonDe-</STRONG>
|
| 210 |
|
|
<STRONG>lay1</STRONG>. If the mouse stays inside the item for <STRONG>bal-</STRONG>
|
| 211 |
|
|
<STRONG>loonDelay1</STRONG>, the balloon window will pop up
|
| 212 |
|
|
displaying the <STRONG>balloonStr</STRONG> value. Once the balloon
|
| 213 |
|
|
window is posted, a new timer based on <STRONG>balloonDe-</STRONG>
|
| 214 |
|
|
<STRONG>lay2</STRONG> is set. This is typically a shorter timer. If
|
| 215 |
|
|
the mouse is moved to another item, the window is
|
| 216 |
|
|
unposted and a new window will be posted over the
|
| 217 |
|
|
item if the shorter delay time is satisfied.
|
| 218 |
|
|
|
| 219 |
|
|
While the balloon window is posted, it can also be
|
| 220 |
|
|
unposted if the item is selected. In this case the
|
| 221 |
|
|
timer is reset to <STRONG>balloonDelay1</STRONG>. Whenever the
|
| 222 |
|
|
mouse leaves the toolbar, the timer is also reset
|
| 223 |
|
|
to <STRONG>balloonDelay1</STRONG>.
|
| 224 |
|
|
|
| 225 |
|
|
This window posting/unposting model is the same
|
| 226 |
|
|
model used in the Windows95 environment.
|
| 227 |
|
|
|
| 228 |
|
|
<EM>pathName</EM> <STRONG>cget</STRONG> <EM>option</EM>
|
| 229 |
|
|
Returns the current value of the configuration option
|
| 230 |
|
|
given by <EM>option</EM>.
|
| 231 |
|
|
|
| 232 |
|
|
<EM>pathName</EM> <STRONG>configure</STRONG> ?<EM>option</EM> <EM>value</EM>?
|
| 233 |
|
|
Query or modify the configuration options of the
|
| 234 |
|
|
widget. If no <EM>option</EM> is specified, returns a list
|
| 235 |
|
|
describing all of the available options for pathName
|
| 236 |
|
|
(see Tk_ConfigureInfo for information on the format of
|
| 237 |
|
|
this list). If <EM>option</EM> is specified with no value, then
|
| 238 |
|
|
the command returns a list describing the one named
|
| 239 |
|
|
option (this list will be identical to the correspond-
|
| 240 |
|
|
ing sublist of the value returned if no option is
|
| 241 |
|
|
specified). If one or more option-value pairs are
|
| 242 |
|
|
specified, then the command modifies the given widget
|
| 243 |
|
|
option(s) to have the given value(s); in this case the
|
| 244 |
|
|
command returns an empty string.
|
| 245 |
|
|
|
| 246 |
|
|
<EM>pathName</EM> <STRONG>delete</STRONG> <EM>index</EM> ?<EM>index2</EM>?
|
| 247 |
|
|
This command deletes all items between <EM>index</EM> and <EM>index2</EM>
|
| 248 |
|
|
inclusive. If <EM>index2</EM> is omitted then it defaults to
|
| 249 |
|
|
<EM>index</EM>. Returns an empty string.
|
| 250 |
|
|
|
| 251 |
|
|
<EM>pathName</EM> <STRONG>index</STRONG> <EM>index</EM>
|
| 252 |
|
|
Returns the widget's numerical index for the entry
|
| 253 |
|
|
corresponding to <EM>index</EM>. If <EM>index</EM> is not found, -1 is
|
| 254 |
|
|
returned.
|
| 255 |
|
|
|
| 256 |
|
|
|
| 257 |
|
|
</PRE>
|
| 258 |
|
|
<H2>value?</H2><PRE>
|
| 259 |
|
|
<EM>pathName</EM> <STRONG>insert</STRONG> <EM>beforeIndex</EM> <EM>widgetCommand</EM> <EM>widgetName</EM> ?<EM>option</EM>
|
| 260 |
|
|
|
| 261 |
|
|
Insert a new item named <EM>widgetName</EM> with the
|
| 262 |
|
|
command <EM>widgetCommand</EM> before the item specified by
|
| 263 |
|
|
<EM>beforeIndex</EM>. If <EM>widgetCommand</EM> is <STRONG>radiobutton</STRONG> or <STRONG>check-</STRONG>
|
| 264 |
|
|
<STRONG>button</STRONG>, its packing is slightly padded to match the
|
| 265 |
|
|
geometry of button widgets. In addition, the <STRONG>indica-</STRONG>
|
| 266 |
|
|
<STRONG>torOn</STRONG> option is <STRONG>false</STRONG> by default and the <STRONG>selectColor</STRONG> is
|
| 267 |
|
|
that of the toolbar background by default. This allows
|
| 268 |
|
|
<STRONG>Radiobutton</STRONG> and <STRONG>Checkbutton</STRONG> widgets to be added as
|
| 269 |
|
|
icons by simply setting their <STRONG>bitmap</STRONG> or <STRONG>image</STRONG> options.
|
| 270 |
|
|
The set of available options is the same as specified
|
| 271 |
|
|
in the <STRONG>ad</STRONG> command.
|
| 272 |
|
|
|
| 273 |
|
|
<EM>pathName</EM> <STRONG>itemcget</STRONG> <EM>index</EM> <EM>option</EM>
|
| 274 |
|
|
Returns the current value of the configuration option
|
| 275 |
|
|
given by <EM>option</EM> for index. The item type of <EM>index</EM>
|
| 276 |
|
|
determines the valid available options.
|
| 277 |
|
|
|
| 278 |
|
|
<EM>pathName</EM> <STRONG>itemconfigure</STRONG> <EM>index</EM> ?<EM>option</EM> <EM>value</EM>?
|
| 279 |
|
|
Query or modify the configuration options of the widget
|
| 280 |
|
|
of the toolbar specified by <EM>index</EM>. If no option is
|
| 281 |
|
|
specified, returns a list describing all of the avail-
|
| 282 |
|
|
able options for <EM>index</EM> (see <STRONG>Tk_ConfigureInfo</STRONG> for infor-
|
| 283 |
|
|
mation on the format of this list). If <EM>option</EM> is speci-
|
| 284 |
|
|
fied with no value, then the command returns a list
|
| 285 |
|
|
describing the one named option (this list will be
|
| 286 |
|
|
identical to the corresponding sublist of the value
|
| 287 |
|
|
returned if no option is specified). If one or more
|
| 288 |
|
|
option-value pairs are specified, then the command
|
| 289 |
|
|
modifies the given widget option(s) to have the given
|
| 290 |
|
|
value(s); in this case the command returns an empty
|
| 291 |
|
|
string. The item type of <EM>index</EM> determines the valid
|
| 292 |
|
|
available options. The set of available options is the
|
| 293 |
|
|
same as specified in the <STRONG>ad</STRONG> command.
|
| 294 |
|
|
|
| 295 |
|
|
|
| 296 |
|
|
</PRE>
|
| 297 |
|
|
<H2>EXAMPLE</H2><PRE>
|
| 298 |
|
|
toolbar .tb -helpvariable statusVar
|
| 299 |
|
|
|
| 300 |
|
|
.tb add button item1 \
|
| 301 |
|
|
-helpstr "Save It" -bitmap @./icons/Tool_32_box.xbm \
|
| 302 |
|
|
-balloonstr "Save" -command {puts 1}
|
| 303 |
|
|
.tb add button item2 \
|
| 304 |
|
|
-helpstr "Save It" -bitmap @./icons/Tool_32_brush.xbm \
|
| 305 |
|
|
-balloonstr "Save" -command {puts 1}
|
| 306 |
|
|
.tb add button item3 \
|
| 307 |
|
|
-helpstr "Save It" -bitmap @./icons/Tool_32_cut.xbm \
|
| 308 |
|
|
-balloonstr "Save" -command {puts 1}
|
| 309 |
|
|
.tb add button item4 \
|
| 310 |
|
|
-helpstr "Save It" -bitmap @./icons/Tool_32_draw.xbm \
|
| 311 |
|
|
-balloonstr "Save" -command {puts 1}
|
| 312 |
|
|
.tb add button item5 \
|
| 313 |
|
|
-bitmap @./icons/Tool_32_erase.xbm -helpstr "Play It" \
|
| 314 |
|
|
-command {puts 2}
|
| 315 |
|
|
.tb add frame filler \
|
| 316 |
|
|
-borderwidth 1 -width 10 -height 10
|
| 317 |
|
|
.tb add radiobutton item6 \
|
| 318 |
|
|
-bitmap @./icons/Tool_32_oval.xbm -command {puts 4} \
|
| 319 |
|
|
-variable result -value OPEN -helpstr "Radio Button # 1" \
|
| 320 |
|
|
-balloonstr "Radio"
|
| 321 |
|
|
.tb add radiobutton item7 \
|
| 322 |
|
|
-bitmap @./icons/Tool_32_line.xbm -command {puts 5} \
|
| 323 |
|
|
-variable result -value CLOSED
|
| 324 |
|
|
.tb add checkbutton item8 \
|
| 325 |
|
|
-bitmap @./icons/Tool_32_text.xbm -command {puts 6} \
|
| 326 |
|
|
-variable checkit -onvalue yes -offvalue no
|
| 327 |
|
|
.tb add checkbutton check2 \
|
| 328 |
|
|
-bitmap @./icons/Tool_32_points.xbm -command {puts 7} \
|
| 329 |
|
|
-variable checkit2 -onvalue yes -offvalue no
|
| 330 |
|
|
|
| 331 |
|
|
pack .tb -side top -anchor nw
|
| 332 |
|
|
|
| 333 |
|
|
|
| 334 |
|
|
|
| 335 |
|
|
</PRE>
|
| 336 |
|
|
<H2>AUTHOR</H2><PRE>
|
| 337 |
|
|
Bill Scott
|
| 338 |
|
|
|
| 339 |
|
|
|
| 340 |
|
|
</PRE>
|
| 341 |
|
|
<H2>KEYWORDS</H2><PRE>
|
| 342 |
|
|
toolbar, button, radiobutton, checkbutton, iwidgets, widget
|
| 343 |
|
|
|
| 344 |
|
|
|
| 345 |
|
|
|
| 346 |
|
|
</PRE>
|
| 347 |
|
|
</BODY>
|
| 348 |
|
|
</HTML>
|