BBjAPI::clearCustomEventCallback

Description

In BBj 6.00 and higher, this method clears a callback that has been set for a specified BBjCustomEvent.

Syntax

Return Value

Method

void

clearCustomEventCallback(string eventName)

Parameters

Variable

Description

eventName

This name identifies the event for which a callback is being cleared.

Return Value

None.

Example

rem 'This program prints a series of numbers in response to

rem 'the posting of custom events.  The order in which the
rem 'numbers are printed depends on whether the number is odd
rem 'or even. Odd numbers are posted as priority custom events
rem 'and printed right away.  The even numbers are put on the
rem 'queue as normal custom events and are printed after the
rem 'odd numbers have been printed.  The program clears the
rem 'custom event once it encounters a custom event with the
rem 'number 6, so the events for numbers 8 and 10 are never
rem 'handled.
rem 'Class for handling the custom event
class public CounterEventHandler

    rem 'The method that actually handles the event
    method public void handleEvent(BBjCustomEvent evt!)
        declare auto BBjNumber payload!
        payload! = evt!.getObject()

        rem 'clear the event handler once we encounter the number 6
        if ((payload! = 6)) then
            BBjAPI().clearCustomEventCallback(evt!.getName())
        endif
        print payload!
    methodend
classend
eventType$="COUNTER"

rem 'Set the custom event handler
BBjAPI().setCustomEventCallback(eventType$,new CounterEventHandler(),"handleEvent")

rem 'Dispatch 10 events. Post odd numbered events as priority events
rem 'and even numbers as normal custom events.
for i = 1 to 10
    if (mod(i,2)) then
        BBjAPI().postPriorityCustomEvent(eventType$,i)
    else
        BBjAPI().postCustomEvent(eventType$,i)
    endif
next i
process_events

See Also

BBjAPI::setCustomEventCallback

BBjEvent

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