BBjColorChooser

Creation Path


BBjAPI

|

+--BBjSysGui

|

+--BBjWindow

|

+--BBjColorChooser

 

Description

In BBj 7.0 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

A BBjColorChooser object is created through the following BBjWindow methods:

 

Return Value

Method

BBjColorChooser

addColorChooser(int ID, int x, int y, int width, int height)

BBjColorChooser

addColorChooser (int ID, int x, int y, int width, int height, BBjColor selected)

BBjColorChooser

addColorChooser (int ID, int x, int y, int width, int height, 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

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.

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.