BBjToolButton

Creation Path


BBjAPI

|

+--BBjSysGui

|

+--BBjWindow

|

+--BBjToolButton

 

Description

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

Implemented Interfaces

DragSource, DropTargetFocusable, Injectable, TabTraversable, TextAlignable

Creation

A BBjToolButton object is created through the following BBjWindow methods:

Return Value

Method

BBjToolButton

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

BBjToolButton

addToolButton(int ID, int x, int y, int width, int height, 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(BBjImage image)

void

setImageFile(string file)

void

setImageSize(int 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()

string

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 p_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 p_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.

CSS

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.


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
RETURN

See Also

BBjAPI

BBjSysGui

BBjWindow

STBL Formats - BBj

BBjConfig::getCompatibilitySetting()

TBUTTON Mnemonic - Create a Tool Button Control

CALLBACK Verb - Register BBj Subroutine

DropTarget

Injectable

TextAlignable

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



______________________________________________________________________________________

Copyright BASIS International Ltd. BBj®, Visual PRO/5®, PRO/5®, and BBx® are registered trademarks.