ClassyTcl

  ClassyTk dynatool definition

Home    Documentation    Screenshots    Binary distributions    Source distribution   

The contents of the toolbars managed by DynaTool in ClassyTk are determined by a toolbar definition. Which definition is used for a type of toolbar is determined in the the configuration system.

A toolbar definition consists of a number of lines. Each line specifies one tool, and starts with a word describing the type of tool. The rest of the line contains a list of parameters. If a parameter contains spaces, it must be surrounded with curly braces ({}) or double quotes (""). A parameter enclosed in curly braces can also span multiple lines. A line can be commented out by starting with a hash character (#). If the toolbar starts with a line "nodisplay", the toolbar will not be displayed. The following tool types are supported:

action

This creates a button that when clicked on will perform some action. It has the following parameters:
  1. id: The button usually displays an icon. DynaMenu will try to find an icon of this name in the configuration directories. If no such icon is found, the name will be displayed as text instead.
  2. help: This text will appear in the balloon help that will popup if the mousepointer stays above the botton without invoking it.
  3. command: This command will be executed when the button is invoked. Each toolbar has an attached cmdw (commmand window) where actions invoked from the toolbar will take place. If the command contains %W it will be replaced with the cmdw of the current toolbar. This can be necessary if one toolbar definition is used for several toolbars, eg. a number of editor windows, where each toolbar should invoke commands on the editor widget in the same window.
A typical example would be:
action save "Save" {filesave %W}

tool

This actually calls a procedure written by the developer to create any type of tool. It only has two parameters:
  1. name: The name of the procdedure to call to create the tool. The procedure will be called with one argument: the name of widget to be created. It must return a line that can be executed to initialise the widget for an other cmdw. In this line, %W will be replaced by the name of the cmdw before execution.
  2. help: Text that will appear in the balloon help that will popup if the mousepointer stays above the botton without invoking it.
A typical example would be:
tool zoomtool "Zoom"

separator

This tool takes no parameters, and just creates a little extra space to separate different bloks of tools.

check

check creates a checkbutton. This is typically used to change a variable to an on or off value. It can also execute a command. It has the following parameters:
  1. id: same as above
  2. help: same as above
  3. options: A number of options as can be given when configuring the Tcl checkbutton. %W will be replaced by the name of the cmdw of the current toolbar.
A typical example would be:
check checked "Checked" {-variable checked -command {puts %W:$checked}}

radio

radio creates a checkbutton. This is typically used to change a variable to one of several values. It can also execute a command. It has the following parameters:
  1. id: same as above
  2. help: same as above
  3. options: A number of options as can be given when configuring the Tcl radiobutton. %W will be replaced by the name of the cmdw of the current toolbar.
A typical example would be:
radio opt1 "opt1" {-variable opt -value opt1 -command {puts %W:$opt}}
radio opt2 "opt2" {-variable opt -value opt2 -command {puts %W:$opt}}

widget

widget can create any widget as a tool. It has the following parameters.
  1. widget command: This command is invoked to create the widget. The command will be invoked with one argument: the name of the widget to be created.
  2. help: same as above
  3. options: A number of options. The widget created will be configured using these options. %W will be replaced by the name of the cmdw of the current toolbar.
An example would be:
widget Entry "Entry" {-command {invoke v {puts %W:$v}}}

label

creates a toollabel that just displays an icon or text. It has the following parameters.
  1. id: same as above
  2. help: same as above
A typical example would be:
label label "Just a label"
Peter De Rijk
hosted at SourceForge.net Logo