Toolbar class derives from Area class and creates a bar of image buttons which is typically placed at the top of a window. The buttons can be shown in a variety of different view modes: either as images, images and text, or just text. Usually toolbar buttons are shown as images only.
When declaring a toolbar widget in XML code, you always need to add at least one toolbar button to it. This is done using Toolbarbutton class. Here is an example XML declaration of a toolbar with six buttons:
<toolbar> <button icon="1">Open</button> <button icon="2">Save</button> <button/> <button icon="3">Cut</button> <button icon="4">Copy</button> <button icon="5">Paste</button> <button/> <button icon="6">Help</button> </toolbar> |
In the XML declaration above, toolbar button 1 will use Hollywood brush 1 as its
image, button 2 will use brush 2, and so on. Note the empty <button/>
declarations:
These will create spacer items to visually separate a group of buttons that belong
together from the rest of the buttons. Toolbar buttons can use many more
options like special images for selected and disabled states, tooltips, and
more. See Toolbarbutton class for details.
There can be only one toolbar per window and it always has to be the first child of the window's root group. RapaGUI won't accept toolbars at random positions in the GUI layout. Toolbars must always be the first child of the window's root group. Thus, they are placed either at the top (horizontal toolbars) or at the left of the window (vertical toolbars).
Also note that it is not possible to create stand-alone instances of this class using moai.CreateObject(). Toolbars always have to be created within the context of a window. Thus, if you want to create toolbars using moai.CreateObject(), you always have to create a complete window and embed the toolbar in this window declaration.
AmigaOS users please also take note that this class requires the TheBar.mcc
extension to be installed.