BBjGeolocation::setCallback
Description
In BBj 11.00 and higher, this method registers the callback routine for a specified event of the BBjGeolocation.
Syntax
| Return Value | Method |
|---|---|
| void | setCallback(int eventType, String gosubLabel) |
| void | setCallback(int eventType, CustomObject customObj, String methodName) |
| void | setCallback(int eventType, Object object, String methodName) |
Parameters
| Parameter | Description |
|---|---|
| eventType | Event type for which the callback is to be registered. |
| gosubLabel | GOSUB label to be executed in PROCESS_EVENTS. |
| customObj | A CustomObject containing the method to be called when the event is processed by PROCESS_EVENTS. |
| methodName | The name of the method that is to be called when the event is processed by PROCESS_EVENTS. |
| object | A Java Object containing the method that is invoked when the event is processed by PROCESS_EVENTS. |
Return Value
None.
Remarks
A callback can only be registered for event types that the BBjGeolocation object can trigger. The BBjGeolocation object page contains a list of events for which callbacks can be registered.
The CALLBACK verb will implicitly GOSUB to the label specified in gosubLabel. Since the block of code executed at gosubLabel is reached through an implicit GOSUB, a RETURN is required at the end of the subroutine.
The CALLBACK implicitly CALLs the publicProgram at the given EntryPoint when the CALLBACK verb uses the publicProgramEntryPoint syntax (ie: "publicProgram::EntryPoint"). Since a CALL has been made to a public program, an ENTER may optionally be used at the beginning, and an EXIT is required at the end.
The setCallback method must be called before the PROCESS_EVENTS verb or within a subroutine that is called in response to an event.
If more than one callback is registered for a specific BBjGeolocation event, the most recently registered callback is used in PROCESS_EVENTS.
When a foreign interpreter invokes this method, an !ERROR=208 Multi Thread error results. See Accessing Objects From Different Interpreters.
Example
See Also
See the BBj Object Diagram for an illustration of the relationship between BBj Objects.