Event Handling
There are three main types of events that the clients of wrapper objects care about: user-interface events (e.g., mouse click and mouse move), IDL output, and IDL notifications. User-interface events are only available for drawable wrapper objects. The IDL output and notifications are available for drawable and nondrawable wrapper objects. The mechanism for the clients to receive wrapper-object events is different for the different wrapper-object languages, as described in Event Handling (COM) and Event Handling (Java).
An IDL notification is a way for an IDL object to relay information back to wrapper object instances while in the middle of a method call. This can be used for things like updating the status of lengthy operations. In order for a wrapper object to receive an IDL notification, the IDL object must inherit from the IDLitComponent object, and the client must subscribe to the wrapper instance’s events. All IDL graphic objects automatically inherit from IDLitComponent. For nondrawable objects, if the IDL object needs to send out a notification, it must explicitly inherit from IDLitComponent.
The IDLitComponent::NotifyBridge method sends the notification. It takes any two strings as parameters. For example, in the pro code below, assume that the object is derived from IDLitComponent and the user wants to inform the client of the status of a lengthy computation.
pro IDLmyObject::DoLongComputation
for I = 0, 10000000 do begin
...
percentDone = CalcPercentDone()
; Send client some status
self->NotifyBridge, 'Completion Status', STRING(percentDone)
endfor
end
Note: IDL objects must derive from IDLitComponent if IDL notifications will be used.