Try OpenEdge Now
skip to main content
GUI for .NET Primer
Object-oriented Programming in ABL : Classes : Class events
 

Class events

Similar to named events in procedure files, class events provide a way to subscribe a method or procedure that executes in response to application conditions. Unlike a named event, which is defined when you publish the event to execute its event handlers, you define class events as members of a class independent of any event handlers that might execute for them. A class event is thus defined with a name, and can have parameters and a return type (similar to a method), which define the signature that must match the signature of any handler for this event. The return type for a class event and its handler is always VOID. Finally, unlike named events that can have only internal procedures as handlers, class events can have both internal procedures and methods as handlers, as long as the handler signatures match the signatures of their respective events.
Like data members, properties, and methods, events can be defined with an access mode, either PUBLIC, PROTECTED, or PRIVATE, that determines where and how the event can have a handler subscribed for it. Events are PUBLIC by default. However, note that events can only be published from within the class where they are defined, regardless of their access mode.
A class event can have multiple handlers subscribed for it in different classes and procedures of an application, and these handlers can also be unsubscribed. ERROR can also be raised for a class event on the statement that publishes the event when any one of its subscribed handlers raises ERROR.