BBjToolButton

Description

The BBjToolButton object provides methods for manipulating a GUI tool button control.

Implemented Interfaces

DragSource, DropTargetFocusable, Injectable, TabTraversable,TextAlignable

Creation

BBjAPI > BBjSysGui > BBjWindow > BBjToolButton

A BBjToolButton object is created through the following BBjWindow methods:

Return Value

Method

BBjToolButton

addToolButton(int ID, number x, number y, number width, number height, string title)

BBjToolButton

addToolButton(int ID, number x, number y, number width, number height, string title, string flags)

BBjToolButton

addToolButton(int ID, string title)

BBjToolButton

addToolButton(int ID, string title, string flags)

BBjToolButton

addToolButton(string title)

BBjToolButton

addToolButton(string title, string flags)

Methods of BBjToolButton

Return Value

Method

void

clearImageSize()

boolean

getBeep()

int

getAlignment()

boolean

getDisableOnClick()

int

getHorizontalTextPosition()

string

getImageFile()

int

getImageHeight()

int

getImageWidth()

boolean

getNoEdge()

int

getVerticalTextPosition()

boolean

isSelected()

boolean

isToggleable()

void

setAlignment(int align)

void

setBeep(boolean beep)

void

setDisableOnClick(boolean disable)

void

setHorizontalTextPosition(int selected)

void

setImage(BBjImageimage)

void

setImageFile(string file)

void

setImageSize(number height, int width)

void

setNoEdge(boolean noEdge)

void

setSelected(boolean selected)

void

setToggleable(boolean toggle)

void

setVerticalTextPosition(int selected)

Methods of BBjToolButton implemented for  DragSource

Return Value Method
int getDragActions()
sting getDragType()
void setDragActions(int actions)
void setDragType(string type)

Methods of BBjToolButton implemented for DropTarget

Return Value Method
int getDropActions()
void setDropActions(int actions)
BBjVector getDropTypes()
void setDropTypes(BBjVector types)

Methods of BBjToolButton implemented for Focusable

Return Value Method
boolean isFocusable()
void setFocusable(boolean focus)

Methods of BBjButton implemented for Injectable

Return Value Method
string getInjectString()
void setInjectString(string injectString)

Methods of BBjToolButton implemented for TabTraversable

Return Value Method
boolean isTabTraversable()
void setTabTraversable(boolean trav)

Methods of BBjToolButton implemented for TextAlignable

Return Value Method
int getAlignment()
void setAlignment(int align)

Methods of BBjToolButton inherited from BBjControl

Events

Callback Code

Object-oriented Event

Read Record Event

Code

ON_DROP_TARGET_DROP

BBjDropTargetDropEvent

Drop Target Drop Event

D

ON_GAINED_FOCUS

BBjGainedFocusEvent

Control Focus Gained/Lost Event

f

ON_FORM_VALIDATION

BBjFormValidationEvent

Form Validation Event

V

ON_LOST_FOCUS

BBjLostFocusEvent

Control Focus Gained/Lost Event

f

ON_MOUSE_ENTER

BBjMouseEnterEvent

Mouse Enter/Exit Event

E

ON_MOUSE_EXIT

BBjMouseExitEvent

Mouse Enter/Exit Event

E

ON_POPUP_REQUEST

BBjPopupRequestEvent

Popup Request Event

r

ON_RIGHT_MOUSE_DOWN

BBjRightMouseDownEvent

Right Mouse Button Down Event

R

ON_TOOL_BUTTON_PUSH

BBjToolButtonPushEvent

Tool Button Push Event

b

The BBjToolButton can be configured to fire the Tool Button Push Event via the right mouse button using the STBL("!COMPAT") key RCLICKTOOLBUTTON.

BUI logoCSS

The visual appearance of BUI controls is defined using CSS (cascading style sheets) rules. Easily change the default colors, border, and other settings by customizing these rules, all without changing any application code. See CSS API for a high-level overview of BUI CSS.

The BBjToolButton can act as either a normal button or a click-on/click-off toggle button. It defines the following style names:

.BBjToolButton (the primary class name)

.BBjToolButton.bbj-checked (the toggle button is checked (on))

.BBjToolButton.bbj-disabled (the button is disabled)

.BBjToolButton.bbj-focused (the button is focused)

.BBjToolButton.bbj-toggle (this is a toggle-style tool button)

.BBjToolButton.bbj-transparent (button is set to transparent with setOpaque(0))

Remarks

By default, tool buttons are not focusable or tab traversable. In BBj 11 and higher, applications that require all tool buttons to be focusable can set the TBUTTON_FOCUSABLE !COMPAT setting to TRUE. Applications that require all tool buttons to be tab traversable can set the TBUTTON_TAB_TRAVERSABLE !COMPAT setting to TRUE.

BUI logo

Mobile touch-oriented browsers (e.g. Mobile Safari in iOS, Chrome in Android) wait for 300 milliseconds after the user taps an element before generating a click event. This delay makes applications feel sluggish when the user tries to click on multiple buttons in rapid sequence, a process that can be common in applications like phone dialers. When the FAST_TOUCH_CLICK !OPTIONS setting is set to TRUE, BUI tool buttons on iOS and Android report ON_TOOL_BUTTON_PUSH immediately when the user touches and releases their finger from a button. This improves the responsiveness for those events, but introduces some side effects that the developer should be aware of. Because BUI is handling touch events on these buttons, normal double-tap and pinch-zoom gestures don't work. And because BUI is reporting the ON_TOOL_BUTTON_PUSH event immediately, it appears in the event stream before the button reports gaining focus. Some applications are sensitive to precise sequence of events.

Constants inherited from BBjControl

Example

rem 'Add a tool button to a window

rem 'Obtain the instance of the BBjAPI object
let myAPI! = BBjAPI()

rem 'Open the SysGui device
SYSGUI = UNT
OPEN (SYSGUI) "X0"

rem 'Obtain the instance of the BBjSysGui object
let mySysGui! = myAPI!.getSysGui()

rem 'Set addWindow param values
X = 10
Y = 10
WIDTH = 200
HEIGHT = 200
TITLE$ = "BBj Window"

rem 'Set the current context
mySysGui!.setContext(0)

rem 'Create a window
myWindow! = mySysGui!.addWindow(X,Y,WIDTH,HEIGHT,TITLE$)

rem 'Add a tool button on the window
myToolButton! = myWindow!.addToolButton(101,50,100,90,30,"Tool Button",$0800$)

rem 'Register the CALLBACK routines
CALLBACK(ON_TOOL_BUTTON_PUSH,TOOL_BUTTON_PUSHED,mySysGui!.getContext(),myToolButton!.getID())
CALLBACK(ON_CLOSE,APP_CLOSE,mySysGui!.getContext())

rem 'Process Events
process_events

rem 'Callback routine called when the tool button is pressed
TOOL_BUTTON_PUSHED:
    rem 'Create the BBjColor Object using colorNum constant
    myColorRed! = mySysGui!.makeColor(mySysGui!.RED)

    rem 'Set the tool button forecolor to RED
    myToolButton!.setForeColor(myColorRed!)
return

rem 'Callback routine called when the user closes the application window
APP_CLOSE:
release

See Also

BBjAPI

BBjSysGui

BBjWindow

STBL Formats - BBj

BBjConfig::getCompatibilitySetting()

TBUTTON Mnemonic - Create a Tool Button Control

CALLBACK Verb - Register BBj Subroutine

DWC Component: dwc-button

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.