TOOLBAR sections define the layout for a toolbar and attach commands to toolbar components. There can be as many TOOLBAR sections as desired, but remember to use the NEW ROW command to keep the lortug window from becoming too wide or tall. As with all section types TOOLBAR sections begin with BEGIN TOOLBAR and end with END TOOLBAR. The twist is that the BEGIN TOOLBAR command takes an argument. This argument controls whether the toolbar is dockable. It can be either YES or NO. For example to create a dockable toolbar use BEGIN TOOLBAR:YES.
The section can be filled with as many toolbar component definitions as desired. Lortug supports five types of toolbar components: buttons, toggle buttons, text boxes, combo boxes and separators.
Button: A push button with an icon on it. When pushed it executes a command list.
BUTTON: [widget name], [icon], [tool tip], [command list]
Toggle button: A toggle button with an icon on it. It can store it's state in a variable and execute one of two different command lists when set to on or off.
TOGGLE: [widget name], [icon], [tool tip], [state var], [command list when true], [command list when false]
Test box: A text entry box. The contents of the box can be stored in a variable and a command list can be excuted when the user hits enter while typing in the box.
TEXT_BOX: [widget name], [tool tip], [width], [state variable], [initial contents], [command list]
Combo box: A combo box. The contents of the text entry part of the box can be stored in a variable and a command list can be executed when the contents of the text box change (either by something being selected from the drop down list of the user hitting enter while typing in the box). The initial contents of the both the text box and drop down list can be specified and the combo box can be made read only so that the user can only select an option form the drop down list.
COMBO_BOX: [widget name], [tool tip], [width], [state variable], [initial text box contents], [initial list contents], [read only], [command list]
Separator: Just some blank space. The width can be set.
SEPARATOR: [width]
The arguments to the component definition lines are:
[widget name]: The name of the component. Used in the SAVE_STATE option in the OPTIONS section.
[icon]: The name of the icon to use. Can be either an absolute path or relative to one of the paths in lortug's icon path (see ICON_PATH in OPTIONS).
[tool tip]: A tool tip for the component.
[command list]: A command list, see Command Lists for more info. If no commands are to be executed this shoulde set to N/A.
[state variable]: A variable that will hold the state of the component. For toggle buttons this will be either "TRUE" if the toggle is down or empty if the toggle is up (see decisions in Command Lists for why the variable is set to empty when the toggle is up). For text boxes and combo boxes the variable will hold the current contents of the box. Multliple components can use the same variable to hold their state, but if one component changes the variable because its state has changed the other components that store their state in that variable will not be changed to reflect the variable's new value.
[width]: Width of the component in pixels.
[initial contents]: The initial contents of a text box. If it contains the name of a variable enclosed in {} then the value of that variable will be substituted (see expansion in Command Lists for more info on the {} operation). If the box should be initially empty then N/A should be used here.
[initial list contents]: The initial contents of a list in a combo box. Entries in the list are delimitied by |. One can also include the contents of a variable in the same way it is done in a text box.
[read only]: If this is not empty (this includes no space between the comma before and after) or not set to false then the combo box will not be read only. If the box is read only the user will not be able to add anything to the drop down list by entering text in the text entry box portion of this component (the user can still select items from the drop down list).
The following example creates a toolbar with a button that runs make on a target specified in a combo box which will also run make when its contents change. The toolbar is not dockable.
BEGIN VARS target = END VARS BEGIN TOOLBAR: NO BUTTON: makeButton, makeIcon.xpm, Make, make {target} COMBO_BOX: targetBox, Make target, 60, target, N/A, all | clean, false, make {target} END TOOLBAR |
Note that the above assumes that the pixmap makeIcon.xpm exists somewhere in lortug's icon path.