BBjColorChooser

Description

In BBj 7.00 and higher, the BBjColorChooser object provides methods for manipulating a GUI color chooser control and an interface to allow users to select colors, for example, in a preferences dialog.

Implemented Interfaces

DropTarget, Focusable, TabTraversable

Creation

BBjAPI > BBjSysGui > BBjWindow > BBjColorChooser

A BBjColorChooser object is created through the following BBjWindow methods:

Return Value

Method

BBjColorChooser

addColorChooser(int ID, number x, number y, number w, number h)

BBjColorChooser

addColorChooser (int ID, number x, number y, number w, number h, BBjColor selected)

BBjColorChooser

addColorChooser (int ID, number x, number y, number w, number h, BBjColor selected, string flags)

BBjColorChooser

addColorChooser(int ID)

BBjColorChooser

addColorChooser(int ID, BBjColor selected!)

BBjColorChooser

addColorChooser(int ID, BBjColor selected!, String flags)

BBjColorChooser

addColorChooser()

BBjColorChooser

addColorChooser(BBjColor selected!)

BBjColorChooser

addColorChooser(BBjColor selected!, String flags)

Methods of BBjColorChooser

Return Value

Method

void

approveSelection()

void

cancelSelection()

string

getApproveButtonText()

string

getCancelButtonText()

BBjColor

getColor()

boolean

getControlButtonsAreShown()

boolean

isPreviewPanelVisible()

void

setApproveButtonText(string text)

void

setCancelButtonText(string text)

void

setColor(BBjColor color)

void

setControlButtonsAreShown(boolean shown)

void

setPreviewPanelVisible(boolean visible)

Methods of BBjColorChooser implemented for DropTarget

Return Value

Method

int

getDropActions()

void

setDropActions(int actions)

BBjVector

getDropTypes()

void

setDropTypes(BBjVector types)

Methods of BBjColorChooser implemented for Focusable

Return Value

Method

boolean

isFocusable()

void

setFocusable(boolean p_focus)

Methods of BBjColorChooser implemented for TabTraversable

Return Value

Method

boolean

isTabTraversable()

void

setTabTraversable(boolean trav)

Methods of BBjColorChooser inherited from BBjControl

Events

Callback Code

Object-oriented Event

Read Record Event

Code

ON_COLORCHOOSER_APPROVE

BBjColorChooserApproveEvent

ColorChooser Approve Event

x

ON_COLORCHOOSER_CANCEL

BBjColorChooserCancelEvent

ColorChooser Cancel Event

x

ON_COLORCHOOSER_CHANGE

BBjColorChooserChangeEvent

ColorChooser Change Event

x

ON_DROP_TARGET_DROP

BBjDropTargetDropEvent

Drop Target Drop Event

D

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.

For a BBjColorChooser sample program, refer to (demo, code). The BBjColorChooser defines the following style names:

.BBjChooser

.BBjColorChooser

.BBjColorChooser.bbj-disabled

.BBjColorChooser.bbj-focused

.BBjColorChooser-preview

.BBjColorChooser-hueRadioButton

.BBjColorChooser-hueValue

.BBjColorChooser-hueDegreeLabel

.BBjColorChooser-saturationRadioButton

.BBjColorChooser-saturationValue

.BBjColorChooser-saturationPercentLabel

.BBjColorChooser-brightnessRadioButton

.BBjColorChooser-brightnessValue

.BBjColorChooser-brightnessPercentLabel

.BBjColorChooser-redRadioButton

.BBjColorChooser-redValue

.BBjColorChooser-greenRadioButton

.BBjColorChooser-greenValue

.BBjColorChooser-blueRadioButton

.BBjColorChooser-blueValue

.BBjColorChooser-colorLabel

.BBjColorChooser-colorValue

.BBjChooser-button-panel

.BBjChooser-button

.BBjChooser-approveButton

.BBjChooser-cancelButton

Remarks

The BBjColorChooser is a complex control provided as-is from a GUI control library. As such, the installed LookAndFeel determines much of its presentation and behavior, attempting to adhere to the platform expectations as much as possible.

Constants inherited from BBjControl

Example

rem 'Add a color chooser 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 = 350
HEIGHT = 250
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 color chooser on the window
myColorChooser! = myWindow!.addColorChooser(101,0,0,350,250)

rem 'Register the CALLBACK routines
CALLBACK(ON_COLORCHOOSER_APPROVE,APPROVED,mySysGui!.getContext(),myColorChooser!.getID())
CALLBACK(ON_COLORCHOOSER_CANCEL,CANCELLED,mySysGui!.getContext(),myColorChooser!.getID())
CALLBACK(ON_CLOSE,CANCELLED,mySysGui!.getContext())

rem 'Process Events
process_events

rem 'Callback routine called when the colorchooser's OK button is pressed
APPROVED:
    rem 'Display a message with the approprate color
    MESSAGE$ = "The Color chosen was: " + STR(myColorChooser!.getColor())
    let X = MSGBOX(MESSAGE$)
release

rem 'Callback routine called when the colorchooser's Cancel button is
rem 'pressed or the window is closed without selecting a color
CANCELLED:
    rem 'Display a message notifying of the cancel
    MESSAGE$ = "No color was chosen!"
    let X = MSGBOX(MESSAGE$)
release

See Also

BBjAPI

BBjSysGui

BBjWindow

CALLBACK Verb - Register BBj Subroutine

Focusable

TabTraversable

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