From AlphaWiki

Interface: AlphaToolbar

Starting with version 8.1a4, AlphaX installs a toolbar in the document windows. The initial goal of this toolbar was to move some controls from the global toolbar to the individual document window: these are the Text info popup menu, the File info popup menu and the Mode info popup menu, and also the row and column indicators. The information provided by these controls is typically window specific and is better located in each window.

The Mac OS X toolbox provides a complete API to design toolbars and attach them to the windows of an application. The basic ideas about toolbars are exposed in the HIToolbar Concepts.

Basic toolbar properties

A toolbar can contain multiple toolbar items, which act as buttons or other controls. The user can show or hide the toolbar by clicking on the clear oblong toolbar button in the upper right corner of the window. A typical toolbar item displays an icon and is activated by a user click. While some items may simply mimic a simple push button, others may contain controls such as pop-up menus and search fields.

A toolbar can display its items as a combination of graphical image and text, text only, or graphics only, with two different sizes. The user can select view modes using a contextual menu displayed by control-clicking in the toolbar or cycle through all available modes by command-clicking the toolbar button.

One advantage of a toolbar over a standard floating palette or other application-defined window is that the contents are user-configurable. The user can rearrange items in the toolbar by command-dragging them around. The user can also remove items entirely by command-dragging and releasing them outside the toolbar.

The user can bring up a sheet containing all the toolbar items supported by the application. To view the configuration sheet, one can choose Customize Toolbar in the contextual menu brought up by control clicking in the toolbar or by command-option-clicking in the toolbar button.

Changes made to the toolbar in one window automatically propagate to the other document windows.

The toolbar can support any number of toolbar items. If there are more items than can be displayed in the window, the user can select the excess items using an overflow pop-up menu displayed at the right of the toolbar.

Default toolbar items

By default, the AlphaX toolbar contains five items: the Text info popup menu, the File info popup menu, the Mode info popup menu, and the row and column indicators. These items can't be removed from the toolbar but you can modify their position by command-dragging them.

Additionnally, one can insert any number of separator items, space items (fixed or flexible). There is also a Print item, a Customize item to display the customization sheet and a Search Field item. These items can be removed.

Creating toolbar items programmatically in AlphaX

The AlphaX toolbar not only is customizable like every toolbars as described above, but it also allows you (as a programmer) to create new custom items and to define commands associated with them. This is done programmatically in Tcl scripts via the [toolbar] command. This command is extensively documented in the ToolbarCommand page on the Wiki.

Note also that the actions associated with the Print item and the Search Field item are defined programmatically by the AlphaTcl library. They execute respectively the [toolbar::doPrint] and [toolbar::doSearch] Tcl procs defined in the toolbar.tcl file.

Retrieved from http://alphatcl.sourceforge.net/wiki/pmwiki.php/Interface/AlphaToolbar
Page last modified on October 02, 2008, at 06:15 PM