BBjAPI::clearCustomEventCallback


Description

In BBj 6.0 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.

Remarks

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

BBj Object Diagram for an illustration of the relationship between BBjObjects.



______________________________________________________________________________________

Copyright BASIS International Ltd. BBj®, Visual PRO/5®, PRO/5®, and BBx® are registered trademarks.