package require twoToolbar ?1.0?
two_toolbar pathName ?options?
two_toolbar is an implementation
of a toolbar consisting of buttons, checkbuttons, radiobuttons, and combobox.
Toolbars can be torn off (to make them float on top of your application).
Buttons have a flat appearance, i.e. the 3D borders only appear when the
mouse is over the button.
combobox widget command takes the
following commands (as the first argument):
- pathName
addtype ?entryoptions?- Add a new entry to the toolbar. type can be any of button, checkbutton, radiobutton, cascade, combobox, separator or newline. The entry newline is the same as a separator, only in torn off state is it handled as a newline, i.e. the entries after this entry are put in the next line. The button can also be called command like in a Tk menu.
- pathName
entrybindindex sequence script- Add a binding to button number index. This is needed as every button exists twice (in the normal toolbar and the torn-off version).
- pathName
entrycgetindex option- Like cget, but applies to button at position index. This is needed as every button exists twice (in the normal toolbar and the torn-off version).
- pathName
entryconfigureindex ?options?- Like configure, but applies to button at position index. This is needed as every button exists twice (in the normal toolbar and the torn-off version).
- pathName
entrycommandindex command ?options?- Apply the command and options to the currently visible incarnation of the element at index position index.
- pathName
tearoffTCL_BOOLEAN- Tear the toolbar off (1) or put it back in place (0).
two_toolbar
command takes all options of the TK frame(n)
widget plus to following
options:
-tearoffTCL_BOOLEAN- Enable/disable tearoff (like menu). Defaults to 1.
-titlestring- Set title of torn-off toolbar to string.
-aliasstring- Set string as an alais to the entry which can be used instead of the index for
entry{configure|cget}.-tipstring- Adds tooltip string to this widget.
-infostring- Adds string for tooltip (long) info string.
-labelstring- identical: set the label of a (radio/check) button.
-textstring- Same as -label.
-commandscript- Evaluated the script (in global context) when button, checkbutton or radiobutton are pressed. The value of the variable associated with the checkbutton or radiobutton has already been updated.
-onvaluevalue- Set the value of a check'ed checkbutton.
-offvalue value- Set the value of an uncheck'ed checkbutton.
-valuevalue- Set the variable associated with a set of radiobuttons to the value of this button if this button is selected.
-variablevarname- varname is the name of the variable (i nglobal context) to be associated with a checkbutton or a radiobutton. This variable will represent the current state of the button (checkbutton: -onvalue/-offvalue; radiobutton: -vlaue). Changes to this variable are traced; if chaged, the state of the button(s) will be adopted, but the script (set with -command) will not be evaluated.
-menuwidgetpath- Specify which menu should be used for
add menu.
two_toolbar consists of a
container frame and a second frame embedded within (class: TwoToolBar,
appended pathname .tb) to enable hiding it. The torn off version of the
toolbar consists of a toplevel widget (class: TwoToolBar, appended pathname
.top). The first element in both toolbar incarantions is the tearoff handle.
All buttons (normal, check, radio) are built using the normal Tk button with different bindings. Buttons have a flat relief and only rise on mouse over. The combobox(n) widget is provieded by this library.
As there are two versions of the toolbar (in place and torn off), there is no widget path to the elements. Configuring the entries and applying tooltips has to be done through the toolbar widget command.
entryconfigure and
entrycget don't (yet) know all options.