BBjColorChooser::setControlButtonsAreShown

Description

In BBj 7.0 and higher, this method will show or hide the BBjColorChooser's [OK] and [Cancel] buttons.

Syntax

Return Value

Method

void

setControlButtonsAreShown(boolean show)

Parameters

Variable

Description

show

True, if the preview panel should be visible; otherwise, false.

Return Value

None.

Remarks

This can be used when using the BBjColorChooser in a palette-like window instead of as a dialog.

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=0
Y=0
WIDTH=550
HEIGHT=250
TITLE$="BBj Lines"

REM Set the current context
mySysGui!.setContext(0)

REM create the target controls for color selection
myWindow! = mySysGui!.addWindow(X, Y, WIDTH, HEIGHT, TITLE$,$00010083$)

REM Add a color chooser on the window
myColorChooser! = myWindow!.addColorChooser(101,200,0,350,250)

REM Hide the control buttons
if (myColorChooser!.getControlButtonsAreShown())
    myColorChooser!.setControlButtonsAreShown(0)
endif

REM Register the CALLBACK routines
CALLBACK(ON_MOUSE_DOWN,CLICK,myWindow!.getContextID(),myWindow!.getID())
CALLBACK(ON_CLOSE,DO_CLOSE,myWindow!.getContextID())

startX = -1
startY = -1

REM Process Events
PROCESS_EVENTS

REM Callback routine called when lines are clicked.
CLICK:
ev! = myAPI!.getLastEvent()
xclick = ev!.getX()
yclick = ev!.getY()
IF (startX = -1)
    startX = xclick
    startY = yclick
    PRINT(SYSGUI)'PUSH'
    PRINT(SYSGUI)'LINE'(xclick, yclick, xclick + 1, yclick + 1)
ELSE
    PRINT(SYSGUI)'POP'
    color! = myColorChooser!.getColor()
    PRINT(SYSGUI)'PENCOLOR'(color!.getRed(),color!.getGreen(),color!.getBlue())
    PRINT(SYSGUI)'LINE'(startX, startY, xclick, yclick)
    startX = -1
    startY = -1
ENDIF
RETURN

DO_CLOSE:
    RELEASE

See Also

BBjAPI

BBjSysGui

BBjWindow

BBjColor

BBjColorChooser

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