TBUTTON Mnemonic - Create a Tool Button Control

Syntax

'TBUTTON'(id,x,y,w,h,title,flags)

Description

The 'TBUTTON' mnemonic creates a tool button control, which is similar to a button control with some significant differences. A tool button:

  • Displays additional information (mouse position, mouse button, Ctrl and Shift key status).

  • Can display either text or a picture (bitmap).

  • Can operate normally or as a toggle (click on, click off).

  • Can use the 'COLORSET' or 'OPTIONS' mnemonic to modify the displayed color.

  • Cannot be focused with keyboard navigation commands.

  • Does not include a "focus rectangle" when it has focus.

Parameter

Description

id

Control ID number. It must be an integer between 1 and 32767 and be unique within a given top-level window.

x

Horizontal position of the upper-left corner of the control in current units.

y

Vertical position of the upper-left corner of the control in current units.

w

Width of the control in current units.

h

Height of the control in current units.

title

Tool button title. The title can be ordinary text or "BITMAP=", followed by a path name. (PREFIX is not searched.) If the BITMAP= syntax is used, an attempt is made to locate and load a bitmapped image (see the 'IMAGE' mnemonic) from that file. If it succeeds, the image is drawn in the button. Otherwise the text, complete with "BITMAP=", is displayed. The title or bitmap can be changed at any time with the 'TITLE' mnemonic. Including the '&' before a character in the title causes it to be an accelerator.

flags

Control flags, as follows:

 

Flag

Description

 

$0001$

Sets the control to be initially disabled.

 

$0002$

Places title text to the left of the control.

 

$0004$

Sets the control to be initially checked.

 

$0010$

Sets the control to be initially invisible.

 

$0400$

Creates a "click on, click off" toggle button.

 

$0800$

Draws a recessed client edge around the control.

 

$1000$

Draws a raised edge around the control.

 

$2000$

Left-justifies tool button text.

 

$4000$

Centers tool button text.

 

$8000$

Right-justifies tool button text.

By default, the title text or bitmap is centered in the button. Vertical centering is always performed, but horizontal justification can be overridden with the control justification flags. With bitmaps, check the appearance in the disabled state. A simple algorithm is performed to transform a color bitmap into a grayed-out bitmap. Lighter colors become the control's background color (normally light gray) and darker colors become gray. Any bitmap that is illegible after this transformation will be illegible on monochrome displays.

When the 'COLORSET' mnemonic is used, the pen color is used to draw the outline, the brush color is used to draw the background, and the text color is used to draw the title text (when a bitmap is not being used).

The 'CHECK' and 'UNCHECK' mnemonics can be used to force the button to a particular state. Even if the button is not a toggle-type button, the 'CHECK' mnemonic will force it into the down position until a mouse click or an 'UNCHECK' raises it.

See the CTRL() function and the SYSGUI Event Queue for additional information on tool buttons.

The 'CUE' mnemonic can be used with tool buttons when they are used with bitmaps instead of text.

See Also

Mnemonics - Alphabetical Listing

Mnemonics - Group Listing