class ToolBar
Topic group Related topics Example
A toolbar assigned to a form.
Properties
The following tables list the properties, events and methods of the ToolBar class.
Property |
Default |
Description |
alignment |
0 |
Set the alignment to determine the placement of the toolbar in the frame. Options are: 0 – Top //default 1 – left 2 – Right 3 – Bottom |
allowdocking |
3 |
Options for allowing the toolbar to be docked. Options are: 0 – None 1 – Horizontal 2 – Vertical 3 – Any //default |
TOOLBAR |
Identifies the object as an instance of the ToolBar class. |
|
(TOOLBAR) |
Identifies the object as an instance of a custom class. When no custom class exists, defaults to baseClassName |
|
enabled |
true |
Logical value which toggles the appearance of buttons on the toolbar between always raised (false) to only raised when the pointer is over a button (true). |
flat |
true |
Logical value which toggles the appearance of buttons on the toolbar between always raised (false) to only raised when the pointer is over a button (true). |
floating |
false |
Logical value that lets you specify your toolbar as docked (false) or floating (true). |
null |
Returns the object reference of the form to which the toolbar is attached. |
|
frame |
|
A reference to the FrameWindow object |
gripper |
true |
Whether or not a gripper is attached to the left side of the toolbar. A gripper will allow the user to grab the toolbar and move it around |
0 |
Returns the toolbar’s handle. |
|
id |
|
a Numeric ID given to the toolbar. The default is -1 until the toolbar is attached to a form. Then this number is set to 1000 initially for the first new toolbar that is created and attached to an open form. For each additional toolbar that is created and then attached to a form, it’s ID is incremented by 1.
For example in the command window you will find the following: t1 = new toolbar() ?t1.id //returns -1 f1 = new form() t1.attach(f1) ?t1.id //returns -1 f1.open() ?t1.id //returns 1000 t2 = new toolbar() f2 = new form() t2.attach(f2) f2.open() ?t2.id //returns 1001 |
imageSource |
|
can be used to specify an image containing multiple toolbutton images within it. In each toolbutton you must also set imageId to an image ID which is just the position of the desired image within the large image beginning with 0 for the left most image and increasing by 1 for each additional image.
For example: t = new toolbar() t.imageSource = "RESOURCE #430 C:\ashley\EXE\Plus_EN.dll" // bitmap with multiple images t.imageWidth = 16 // 24 or 32 pixel depth each button image t.imageHeight = 16 // usually the same as imageWidth
tb1 = new toolbutton(t) tb1.imageId = 0 // leftmost image from toolbar's imageSource
tb2 = new toolbutton(t) tb2.imageId = 1 // use second from left image
tb3 = new toolbutton(t) tb3.imageid = 2 // use third from left image
etc... |
imageHeight |
0 |
Adjusts the default height for all buttons on the toolbar. Since all buttons must have the same height, if ImageHeight is set to 0, all buttons will match the height of the tallest button. If ImageHeight is set to a non-zero positive number, images assigned to buttons are either padded (by adding to the button frame) or truncated (by removing pixels from the center of the image or by clipping the edge of the image). |
imageWidth |
0 |
Specifies the width, in pixels, for all buttons on the toolbar. |
0 |
Specifies the distance from the left side of the screen to the edge of a floating toolbar. |
|
name |
|
The name of the toolbar. You can name your toolbar to make identifying it a little easier, especially if you have multiple versions of your toolbar in memory. |
padding |
6 |
Pads the height of the toolbar. |
parent |
|
The current FRAMEWINDOW object. |
|
String that appears in the title bar of a floating toolBar. |
|
toolItems |
|
A read only property which contains an array object containing the toolbutton objects that are defined in the toolbar.
For example: t = new toolbar() tb = new toolButton(t) ?t.toolItems[1].baseClassName //returns TOOLBUTTON or ?t.toolItems[“tb”].baseClassName |
0 |
Specifies the distance from the top of the screen to the top of a floating toolbar. |
|
transparent |
false |
whether or not the background of the toolbar shows the same as the frame's background. |
true |
Logical property that lets you hide or reveal the toolbar. |
|
Event |
Parameters |
Description |
onCommand |
|
Fires
when any toolbutton is pressed. Can be used to determine what
happens when any toolbutton is pressed by the user. app.t = new toolbar() _app.t.onCommand = {;if upper(app.databases.current.databasename) <> "DBASESAMPLES"; this.b1.onClick = null; this.b2.onClick = null; else; this.b1.onClick = CLASS::B1_ONCLICK; this.b2.onClick = CLASS::B2_ONCLICK; endif; ?"onclick = ",this.b1.onclick} |
|
Fires repeatedly while application is idle to update the status of the toolbuttons |
|
Method |
Parameters |
Description |
<form> |
Establishes link between the toolbar and a form |
|
<form> |
Breaks link between the toolbar and a form |
Description
Use class ToolBar to add a toolbar to a form.