Each toolbar and toolbutton has its own set of properties, events and methods. The following tables describe the primary elements you’ll use to define your toolbars.

Tip

To inspect all toolbar and toolbutton properties, methods and events, as well as their defaults, type commands similar to those below into the Command window:

t1 = new toolbar( )

t2 = new toolbutton( t1 )

inspect( t1 ) // opens the Inspector with toolbar properties visible

inspect( t2 ) // opens the Inspector with toolbutton properties visible

 

The following tables list the properties, events and methods of the ToolBar class.

Property

Description

baseClassName

Identifies the object as an instance of the ToolBar class.

className

Identifies the object as an instance of a custom class. When no custom class exists, defaults to baseClassName

flat

Logical value (default true) which toggles the appearance of buttons on the toolbar from always raised (false) to only raised when the pointer is over a button (true).

floating

Logical value (default false) that lets you specify your toolbar as docked (false) or floating (true).

form

Returns the object reference of the form to which the toolbar is attached.

hWnd

Returns the toolbar’s handle.

imageHeight

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

Specifies the width, in pixels, for all buttons on the toolbar.

left

Specifies the distance from the left side of the screen to the edge of a floating toolbar.

text

String that appears in the title bar of a floating toolBar.

top

Specifies the distance from the top of the screen to the top of a floating toolbar.

visible

Logical property that lets you hide or reveal the toolbar. Default is true.

 

Event

Description

onUpdate

Fires when the application containing the toolbar is idle, intended for simple routines that enable, disable or otherwise update the toolbar. Because this event fires continuously when the application is idle, you should avoid coding elaborate, time-consuming routines in this event.

 

Method

Description

attach( )

Attach(<form object reference>) establishes communication between the toolbar and the specified form and sets the Form property of the toolbar. Note that a toolbar can be attached to multiple MDI forms or to a single SDI form.

detach( )

Detach(<form object reference>) ends communication between the toolbar and the specified form, and closes the toolbar if it is not attached to any other open form.

 

The following tables list the properties and events of the ToolButton class. (No methods are associated with this class.)

Property

Description

baseClassName

Identifies the object as an instance of the ToolButton class.

bitmap

Graphic file (any supported format) or resource reference that contains one or more images that are to appear on the button.

bitmapOffset

Specifies the distance, in pixels, from the left of the specified Bitmap to the point at which your button graphic begins. This property is only needed when you specify a Bitmap that contain a series of images arranged from left to right. Use with bitmapWidth to specify how many pixels to display from the multiple-image Bitmap. Default is 0 (first item in a multiple-image Bitmap).

bitmapWidth

Specifies the number of pixels from the specified Bitmap that you want to display on your button. This property is only needed when you specify a Bitmap that contain a series of images arranged from left to right. Use with bitmapOffset, which specifies the starting point of the image you want to display.

checked

Returns true if the button has its twoState property set to true. Otherwise returns false.

className

Identifies the object as an instance of a custom class. When no custom class exists, defaults to baseClassName

enabled

Logical value (default true) that specifies whether or not the button responds when clicked. When set to false, the operating system attempts to visually change the button with hatching or a low-contrast version of the bitmap to indicate that the button is not available.

separator

Logical value that lets you set a vertical line on the toolbar to visually group buttons. If you specify a separator button, only its visible property has any meaning.

speedTip

Specifies the text that appears when the mouse rests over a button for more than one second.

twoState

Logical value that determines whether the button displays differently when it has been depressed and consequently sets the checked property to true. Default is true.

visible

Logical value that lets you hide (false) or show (true) the button. Default is true.

 

Event

Description

onClick

"Action code" that executes when the button is clicked.