toolbar - Create and manipulate a tool bar

SYNOPSIS

toolbar pathName ?options?

STANDARD OPTIONS

activeBackground
activeForeground
background
borderWidth
highlightThickness
selectColor
font
foreground
highlightBackground
highlightColor
selectBorderWidth
insertForeground
orient
relief
selectBackground
disabledForeground
selectForeground
state
troughColor
cursor
insertBackground

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.

WIDGET-SPECIFIC OPTIONS

Name:                   balloonBackground
Class:                  BalloonBackground
Command-Line Switch:	-ballooonbackground

Name:                   balloonDelay1
Class:                  BalloonDelay1
Command-Line Switch:	-balloondelay1

Name:                   balloonDelay2
Class:                  BalloonDelay2
Command-Line Switch:	-balloondelay2

Name:                   balloonFont
Class:                  BalloonFont
Command-Line Switch:	-balloonfont

Name:                   balloonForeground
Class:                  BalloonForeground
Command-Line Switch:	-ballooonforeground

Name:                   helpVariable
Class:                  HelpVariable
Command-Line Switch:	-helpvariable

Name:                   orient
Class:                  Orient
Command-Line Switch:	-orient

DESCRIPTION

The toolbar command creates a new window (given by the pathName argument) and makes it into a toolbar widget. Additional options, described above may be specified on the command line or in the option database to configure aspects of the toolbar such as its colors, font, and orientation. The toolbar 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 toolbar 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 usually for user convenience to give access to a set of commands 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 widgets to appear on a toolbar.

In addition, the toolbar adds two new options to all widgets that are added to it. These are the helpStr and balloonStr options. See the discussion for the widget command add below.

WIDGET-SPECIFIC METHODS

The toolbar command creates a new Tcl command whose name is pathName. This command may be used to invoke various operations on the widget. It has the following general form:

pathName option ?arg arg ...?
Option and args determine the exact behavior of the command.

Many of the widget commands for a toolbar take as one argument an indicator of which widget item of the toolbar to operate on. The indicator is called an index and may be specified in any of the following forms:

number
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).
end
Specifes the last widget in the toolbar's index. If the toolbar is empty this will return -1.
last
Same as end.
pattern
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:

pathName add widgetCommand widgetName ?option value?
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 widgetCommand supports. In addition they may also be one of the following options:
pathName cget option
Returns the current value of the configuration option given by option.
pathName configure ?option value?
Query or modify the configuration options of the widget. If no option 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 option is specified 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.
pathName delete index ?index2?
This command deletes all items between index and index2 inclusive. If index2 is omitted then it defaults to index. Returns an empty string.
pathName index index
Returns the widget's numerical index for the entry corresponding to index. If index is not found, -1 is returned.
pathName insert beforeIndex widgetCommand widgetName ?option value?
Insert a new item named widgetName with the
command widgetCommand before the item specified by beforeIndex. 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. The set of available options is the same as specified in the ad command.
pathName itemcget index option
Returns the current value of the configuration option given by option for index. The item type of index determines the valid available options.
pathName itemconfigure index ?option value?
Query or modify the configuration options of the widget of the toolbar specified by index. If no option is specified, returns a list describing all of the available options for index (see Tk_ConfigureInfo for information on the format of this list). If option is specified 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 index determines the valid available options. The set of available options is the same as specified in the ad command.

EXAMPLE

 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

AUTHOR

Bill Scott

KEYWORDS

toolbar, button, radiobutton, checkbutton, iwidgets, widget