BBjButton

Description

The BBjButton object provides methods for manipulating a GUI button control.

Implemented Interfaces

DragSource, DropTargetFocusable, Injectable, TabTraversable,TextAlignable

Creation

BBjAPI > BBjSysGui > BBjWindow > BBjButton

A BBjButton object is created through the following BBjWindow methods:

Return Value

Method

BBjButton

addButton(int ID, number x, number y, number w, number h, String title)

BBjButton

addButton(int ID, number x, number y, number w, number h, String title, String flags)

BBjButton addButton(int ID, String title)
BBjButton addButton(int ID, String title, String flags)
BBjButton addButton(String title)
BBjButton addButton(String title, String flags)

Methods of BBjButton

Return Value

Method

void

clearImage()

void

clearImageSize()

boolean

getBeep()

boolean

getDisableOnClick()

string

getImageFile()

int

getImageHeight()

int

getImageWidth()

boolean

getNoEdge()

int

getVerticalAlignment()

void

setBeep(boolean beep)

void

setDisableOnClick(boolean disable)

void

setImage(BBjImage image)

void

setImageFile(string file)

void

setImageSize(number width, int height)

void

setNoEdge(boolean noEdge)

void

setVerticalAlignment(int alignment)

Methods of BBjButton implemented for DragSource

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

Methods of BBjButton implemented for DropTarget

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

Methods of BBjButton 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 BBjButton implemented for TabTraversable

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

Methods of BBjButton implemented for TextAlignable

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

ClosedMethods of BBjButton inherited from BBjControl

DWC logoBBjButton's DWC Properties , Shadow Parts , Hosted Classes , and CSS Custom Properties

Events

Callback Code Object-oriented Event Read Record Event Code
ON_BUTTON_PUSH BBjButtonPushEvent Push Button Event B
ON_DROP_TARGET_DROP BBjDropTargetDropEvent Drop Target Drop Event D
ON_FORM_VALIDATION BBjFormValidationEvent Form Validation Event V
ON_GAINED_FOCUS BBjGainedFocusEvent Control Focus Gained/Lost Event f
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

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 BBjButton is implemented as a <div> element. It has two variants, .BBjButton.bbj-default, applied to any button with a control ID of 1, and .BBjButton.bbj-cancel, applied to any button with a control ID of 2. The BBjButton defines the following style names:

.BBjButton

.BBjButton.bbj-cancel

.BBjButton.bbj-default

.BBjButton.bbj-disabled

.BBjButton.bbj-focused

.BBjButton.bbj-transparent

There are many different options for styling the BBjButton. One simple choice would be to add rounded borders:

.BBjButton
{
    border-radius: 10px;
}

BUI logoRemarks

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 !OPTIONSsetting is set to TRUE, BUI buttons on iOS and Android report ON_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_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.

ClosedConstants inherited from BBjControl

Example

rem ' BBjButton

sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
window! = sysgui!.addWindow(25,25,200,275,"BBjButton",$00090003$)
window!.setCallback(window!.ON_CLOSE,"eoj")
default! = window!.addButton(1,25,25,150,25,"OK",$$)
default!.setToolTipText("BBjButton (Default)")
default!.setCallback(default!.ON_BUTTON_PUSH,"event")
cancel! = window!.addButton(2,25,75,150,25,"Cancel",$$)
cancel!.setToolTipText("BBjButton (Cancel)")
cancel!.setCallback(cancel!.ON_BUTTON_PUSH,"event")
ImageManager! = sysgui!.getImageManager()
openImage! = ImageManager!.loadImageFromServerJar("com/basis/bbj/images/open.gif")
text! = window!.addButton(101,25,125,150,25,"Open",$$)
text!.setToolTipText("BBjButton (Text)")
text!.setCallback(text!.ON_BUTTON_PUSH,"event")
image! = window!.addButton(102,25,175,150,25,"",$$)
image!.setImage(openImage!)
image!.setImageSize(openImage!.getWidth(),openImage!.getHeight())
image!.setToolTipText("BBjButton (Image)")
image!.setCallback(image!.ON_BUTTON_PUSH,"event")
both! = window!.addButton(103,25,225,150,25,"Open",$$)
both!.setImage(openImage!)
both!.setToolTipText("BBjButton (Text+Image)")
both!.setCallback(both!.ON_BUTTON_PUSH,"event")
process_events

eoj:
release

event:
    event! = sysgui!.getLastEvent()
    button! = event!.getButton()
    i = msgbox(button!.getText()+" "+str(button!.getID()),0,event!.getEventName())
return

See Also

BBjAPI

BBjSysGui

BBjWindow

BUTTON Mnemonic - Create a Push 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.