BBjControl

Description

The BBjControl object is the base object for all SysGui controls and it provides methods for manipulating these controls.

Creation

BBjAPI > BBjSysGui > BBjControl

The BBjControl object is obtained with the following BBjWindow object method:

Return Value

Method

BBjControl

getControl(int id)

Methods of BBjControl

Return Value Method
void addClass(string className)
BBjPopupMenu addPopupMenu()
boolean addStyle(string styleName)
void clearCallback(int eventType)
void clearStyles()
void destroy()
void focus()
string getAttribute(string attribute)
BBjColor getBackColor()
boolean getBeepOnValidationFailure()
boolean getCausesControlValidation()
boolean getClientEdge()
BBjVector getClassList()
Object getClientProperty(Object key)
string getComputedStyle(string property)
int getContextID()
int getControlType()
BBjFont getFont()
BBjColor getForeColor()
int getHeight()
int getID()
string getLongCue()
string getName()
boolean getNoEdge()
BBjWindow getParentWindow()
BBjPopupMenu getPopupMenu()
Object getProperty(String key)
Object getProperty(String key, Type type)
boolean getRaisedEdge()
int getScreenX()
int getScreenY()
string getShortCue()
string getStyle(string property)
bBjVector getStyles()
string getText()
string getToolTipText()
Object getUserData()
int getWidth()
int getX()
int getY()
boolean isDestroyed()
boolean isEnabled()
boolean isGrouped()
boolean isOpaque()
boolean isVisible()
void putClientProperty(Object key, Object value)
void removeAttribute(string attribute)
void removeClass(string className)
void removePopupMenu()
boolean removeStyle(string styleName)
void setAttribute(string attribute, string value)
void setBackColor(BBjColor color!)
void setBeepOnValidationFailure(boolean shouldBeep)
void setCallback(int eventType, CustomObject customObj, string methodName)
void setCallback(int eventType, string subRoutineName)
void setCausesControlValidation(boolean valid)
void setClientEdge(boolean client)
void setCursor(int cursor)
void setEnabled(boolean enabled)
void setFont(BBjFont font!)
void setForeColor(BBjColor color!)
void setGrouped(boolean grouped)
void setLocation(int x, int y)
void setLongCue(string cue)
void setName(string name)
void setNoEdge(boolean noEdge)
void setOpaque(boolean opaque)
void setPopupMenu(BBjPopupMenu popupMenu!)
void setProperty(String key, Object value)
void setProperty(String key, Object value, Type type)
void setRaisedEdge(boolean raised)
void setShortCue(string cue)
void setSize(int width, int height)
void setStyle(string property, string value)
void setText(string text)
void setToolTipText(string text)
void setUserData(Object userData)
void setVisible(boolean visible)
void showToolTipText() showToolTipText(int x, int y)
boolean toggleClass(string className)
void unsetStyle(string property)

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.

All BUI windows and controls inherit the BBjControl style. The basic implementation of this style sets the following CSS properties:

.BBjControl
{
    box-sizing: border-box; 
    font: inherit;
}

The box-sizing: border-box setting says that a control defined for a given size will take up precisely that size on the screen, with any padding and borders going inside that defined size. The font: inherit setting initializes the font of each control to the font of its parent. If a custom CSS file defines additional styles for the .BBjControl selector, they'll be applied to every control and every window -- so use this sparingly.

Remarks

All SysGui controls (BBjWindow, BBjGrid, BBjTree, etc.) are also BBjControl objects. All BBjControl object methods, except where otherwise noted, can be used on all controls.

Constants

Value Control Constant
-1 UNKNOWN_CONTROL
0 WINDOW
1 MAIN_WINDOW
2 CHILD_WINDOW
3 MENU
4 SPECIAL_CONTROL
5 NATIVE_CONTROL
11 PUSHBUTTON_CONTROL
12 RADIOBUTTON_CONTROL
13 CHECKBOX_CONTROL
14 HSCROLL_CONTROL
15 VSCROLL_CONTROL
16 EDIT_CONTROL
17 TEXT_CONTROL
18 LISTBOX_CONTROL
19 LISTBUTTON_CONTROL
20 LISTEDIT_CONTROL
21 GROUPBOX_CONTROL
22 CEDIT_CONTROL
24 LINECHART_CONTROL
25 BARCHART_CONTROL
26 PIECHART_CONTROL
27 HTMLVIEW_CONTROL
28 MENUBUTTON_CONTROL
29 PRINTPREVIEW_CONTROL
30 GENERICCHART_CONTROL
31 WRAPPED_JCOMPONENT_CONTROL
32 WEB_COMPONENT_CONTROL
91 INPUTT_CONTROL
92 INPUTT_SPINNER_CONTROL
99 SPLITTER_CONTROL
100 MENUITEM_CONTROL
101 CHECKABLE_MENUITEM_CONTROL
102 STATUSBAR_CONTROL
103 TOOLBUTTON_CONTROL
104 INPUTE_CONTROL
105 INPUTN_CONTROL
106 TAB_CONTROL
107 GRID_CONTROL
108 IMAGE_CONTROL
109 TREE_CONTROL
110 DATAAWARE_GRID_CONTROL
112 PROGRESS_CONTROL
113 NAVIGATOR_CONTROL
114 INPUTD_CONTROL
115 NAMESPACE_CONTROL
116 GRID_HEADER_CONTROL
117 HSLIDER_CONTROL
118 VSLIDER_CONTROL
119 FILECHOOSER_CONTROL
120 COLORCHOOSER_CONTROL
121 FONTCHOOSER_CONTROL
122 DATABOUND_GRID_CONTROL
123 INPUTD_SPINNER_CONTROL
124 INPUTE_SPINNER_CONTROL
125 INPUTN_SPINNER_CONTROL
126 EDIT_SPINNER_CONTROL
127 HTMLEDIT_CONTROL

Alignment Constants

ALIGN_LEFT
ALIGN_RIGHT
ALIGN_CENTER

Orientation Constants

HORIZONTAL
VERTICAL

Menu Cut/Copy/Paste Constants

Value Constant
32027 CUT
32028 COPY
32029 PASTE

Color Constants

Value Constant
0 BLACK
1 BLUE
2 RED
3 MAGENTA
4 GREEN
5 CYAN
6 YELLOW
7 WHITE
8 DKGRAY
9 GRAY
10 LTGRAY

Example

rem 'Get a control from 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 common addWindow param values
X = 10
Y = 10
WIDTH = 200
HEIGHT = 200

rem 'Create a window with a title in the current context
TITLE$="BBj Window"

rem 'Set the current context
mySysGui!.setContext(0)
myWindow! = mySysGui!.addWindow(X,Y,WIDTH,HEIGHT,TITLE$)

rem 'Add a button on the window using mnemonics
PRINT (SYSGUI)'BUTTON'(101,50,100,90,30,"Button",$$)

rem 'Get the button
myButton! = myWindow!.getControl(101)

rem 'Register the CALLBACK routines
CALLBACK(ON_CLOSE,APP_CLOSE,mySysGui!.getContext())

rem 'Process Events
process_events

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

ClosedVersion History

  • BBj 24.00: Added toggleClass.
  • BBj 24.00: Added getProperty, setProperty, and WEB_COMPONENT_CONTROL constant 32.
  • BBj 23.06: Added two constants for BBjControl: 91 (INPUTT_CONTROL) and 92 (INPUTTSPINNER_CONTROL).

See Also

BBjAPI

BBjSysGui

BBjWindow Methods

BBj Object Variables

BBj Object Assignment

BBj Object Error Handling

BBj Object Operators

RecordSetBindable

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