Publish and respond to class events
- Last Updated: October 30, 2020
- 2 minute read
- OpenEdge
- Version 12.2
- Documentation
You can publish a class event using the built-in Publish( ) event
method from within the class that defines the event (see the ).
The event definition cannot be abstract. When you invoke this method
for a given class event, it executes any and all event handlers
that you previously subscribed to the event. You also pass any parameters
to this method that you defined for the event, and they get passed
to each event handler that executes. The method returns any results
to the caller.
You can subscribe an event handler to an event using the built-in Subscribe( ) event
method. An event to which you subscribe an event handler can be
defined as abstract. The subscription then applies to the class
in the hierarchy where the event is actually implemented. The access
mode of an event determines where you can execute the Subscribe( ) method
on the event, whether inside or outside the class or class hierarchy
where the event is defined. In any case, you can subscribe any accessible
method or internal procedure with a compatible signature as a handler
for the event, even if the method or internal procedure is not accessible
to the publishing class. Using the built-in Unsubscribe( ) event
method, you can also remove a method or internal procedure as an
event handler for the event, again, depending on the access mode
of the event.
For more information on publishing and responding to class events, see Publish and subscribe to class events.