dockbar - Create and manipulate a dock bar
SYNOPSIS
dockbar pathName ?options?
STANDARD OPTIONS
background
borderWidth
cursor
|
foreground
highlightBackground
highlightColor
|
highlightThickness
|
|
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: propertyCommand
Class: PropertyCommand
Command-Line Switch: -propertycommand
Specifies the command to use save and restore properties of the
widget. When this command is specified it will be used to
maintian user toolbar configurations across tool invocations. The
command specified must accept two forms:
command "set" propertyName valueVar
command "get" propertyName valueVar defaultValue
On Windows this command is easily
implemented using the Tcl [registry] command.
Name: propertyPrefix
Class: PropertyPrefix
Command-Line Switch: -propertyprefix
Specifies the prefix name used to construct property names when saving
and restoring widget configurations. (see propertyCommand above).
DESCRIPTION
The dockbar command creates a frame (given by the pathName
argument) to hold toolbars. 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 dockbar
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 dockbar is a widget that displays a collection of toolbar
widgets arranged in a row. Each toolbar may contain any number of
widgets that are 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.
Each toolbar within the dockbar may be shown or hidden and the user
can rearrange the toolbars simply by grabbing and dragging the handle
on each toolbar. A popup menu is available via the RMB that will
control the visibility of each toolbar.
Many of the configuration options available in the dockbar are
passed down to the individual toolbars. (see the toolbar manual for
more information)
WIDGET-SPECIFIC METHODS
The dockbar 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 dockbar 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 toolbar numerically, where 0 corresponds to the
first
toolbar 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 toolbar in the dockbar's index. If the dockbar
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 name of each toolbar in
the
dockbar, in order from the first to the last toolbar, until a matching
entry is
found. An exact match must occur.
The following commands are possible for toolbar widgets:
- pathName add toolbarName ?option
value?
- Adds a toolbar whose name is toolbarName to the
toolbar. If additional arguments are present, they are the set of
available options
that the toolbar supports.
- 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 hide index
- This command will remove the toolbar specified by index
from the display.
(The toolbar is not destroyed.)
- pathName index index
- Returns the toolbar's numerical index for the entry
corresponding to index. If index is not found, -1 is
returned.
- 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 add command.
- pathName itemname index
- This command will return the name of the toolbar specified by index.
- pathName move index x y
- This command will move the toolbar specified by index to
the location given by x and y.
- pathName remove index
- This command deletes the toolbar specified by index. The
toolbar is destroyed.
- pathName show index
- This command makes the toolbar specified by index
visible.
EXAMPLE
package require Dockbar
::dockbar .db
pack .db -side top -expand 1 -fill x
set idir [file join [file dir [info script]] images]
set edit [.db add edit -wrap 0 -helpvariable statusVar]
$edit add button item1 \
-helpstr "Select Area" \
-bitmap @${idir}/box.xbm \
-balloonstr "Select" \
-command {puts "Select command"}
$edit add button item2 \
-helpstr "Cut Selected" \
-image [image create photo -file ${idir}/cut.gif] \
-balloonstr "Cut" \
-command {puts "Cut command"}
$edit add button item3 \
-helpstr "Copy Selected" \
-image [image create photo -file ${idir}/copy.gif] \
-balloonstr "Copy" \
-command {puts "Copy command"}
$edit add button item4 \
-helpstr "Paste from Clipboard" \
-image [image create photo -file ${idir}/paste.gif] \
-balloonstr "Paste" \
-command {puts "Paste command"}
$edit add button item5 \
-image [image create photo -file ${idir}/close.gif] \
-helpstr "Close" \
-command {puts "Close command"}
set tool [.db add tool -wrap 0 -helpvariable statusVar]
$tool add radiobutton item6 \
-bitmap @${idir}/oval.xbm \
-command {puts "Oval mode $result"} \
-variable result \
-value OPEN \
-helpstr "Draw Oval" \
-balloonstr "Oval"
$tool add radiobutton item7 \
-bitmap @${idir}/line.xbm \
-command {puts "Line mode $result"} \
-variable result \
-value CLOSED
$tool add checkbutton item8 \
-bitmap @${idir}/text.xbm \
-command {puts "Text text mode $checkit"} \
-variable checkit \
-onvalue on \
-offvalue off
$tool add checkbutton check2 \
-bitmap @${idir}/points.xbm \
-command {puts "Points mode $checkit2"} \
-variable checkit2 \
-onvalue on \
-offvalue off
text .tx
pack .tx -side top -fill both -expand 1
set fp [open [info script]]
.tx insert insert [read $fp]
close $fp
label .msg -textvariable statusVar
pack .msg -side bottom -fill x -expand 1
AUTHOR
Brian Griffin
KEYWORDS
dockbar, toolbar, button, radiobutton, checkbutton, widget