BBjControl::clearCallback

Description

In BBj 2.01 and higher, this method unregisters the callback routine for a specified event of the BBjControl.

Syntax

Return Value

Method

void

clearCallback(int eventType)

Parameters

Variable

Description

eventType

Event type for which the callback is to be unregistered.

Return Value

None.

Remarks

An attempt to unregister a callback that has not been registered either through the CALLBACK verb, or through BBjControl::setCallback results in a runtime error.

When a foreign interpreter invokes this method, an !ERROR=208 Multi Thread results. See Accessing Objects From Different Interpreters.

Example

rem 'Clear a Callback using BBj::clearCallBack

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 = 300
HEIGHT = 200
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 button on the window
myRedButton! = myWindow!.addButton(101,150,100,90,30,"Red",$0800$)
myDisableButton! = myWindow!.addButton(102,50,100,90,30,"Disable Red",$0800$)

rem 'Register the CALLBACK routines
myRedButton!.setCallback(myRedButton!.ON_BUTTON_PUSH,"RED_BUTTON_PUSHED")
let rn$ = "DISABLE_BUTTON_PUSHED"
myDisableButton!.setCallback(myDisableButton!.ON_BUTTON_PUSH,rn$)
myWindow!.setCallback(myWindow!.ON_CLOSE,"APP_CLOSE")

rem 'Process Events
process_events

rem 'Callback routine called when the red button is pressed
RED_BUTTON_PUSHED:
    rem 'Create the BBjColor Object using colorNum constant
    myColorRed! = mySysGui!.makeColor(mySysGui!.RED)

    rem 'Set the button colors to RED
    myRedButton!.setBackColor(myColorRed!)
return

rem 'Callback routine disables red button callback
DISABLE_BUTTON_PUSHED:
    myRedButton!.clearCallback(myRedButton!.ON_BUTTON_PUSH)
    myRedButton!.setText("Red disabled")
return

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

See Also

BBjAPI

Object Variables

PROCESS_EVENTS Verb

BBjControl::setCallback

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