EVENTS evt [EXPORTING parameters].
Declares an instance event evt in a class or interface. The
Naming conventions apply to the name evt. Using the
RAISE EVENT statement, the instance event
evt can be raised in any instance method of the same class, or of any class that implements the interface, as well as in the instance methods of subclasses - if they are visible there.
... EXPORTING parameters
The EXPORTING addition defines the parameter interface of the event evt. An event can only have output parameters parameters that are passed by value.
When you declare an event handler with the addition FOR EVENT OF of a METHODS or CLASS-METHODS statement, the output parameters of the event are defined as the input parameters of the event handler. The properties of the input parameters are copied across from the output parameters defined in EVENTS.
As well as the output parameters defined explicitly using EXPORTING, each instance event has an implicit output parameter, sender. This output parameter has the type of a reference variable. When the event is raised using RAISE EVENT, the reference to the raising object is implicitly assigned to sender.
Until Release 6.10, the static type of the implicit parameter
sender was specified by the class or interface in which
the EVENTS statement occurred. Since Release 6.10, the
static type of sender is specified using the
FOR EVENT OF addition of the METHODS or CLASS-METHODS statement.
The dynamic type of the implicit formal parameter sender is always the class of the object in which the event is raised.
In the interface window, three events are declared, each with an explicit non-optional output parameter status. The class dialog_window implements the interface window. The interface window_handler contains event handlers, which import both the explicit parameters and the implicit parameter sender. The static type of the input parameter sender is the class dialog_window. Before Release 6.10, it was the interface window.
INTERFACE window.
EVENTS: minimize EXPORTING VALUE(status) TYPE i,
maximize EXPORTING VALUE(status) TYPE i,
restore EXPORTING VALUE(status) TYPE i.
ENDINTERFACE.
CLASS dialog_window DEFINITION.
PUBLIC SECTION.
INTERFACES window.
ENDCLASS.
INTERFACE window_handler.
METHODS: minimize_window
FOR EVENT window~minimize OF dialog_window
IMPORTING status sender,
maximize_window
FOR EVENT window~maximize OF dialog_window
IMPORTING status sender,
restore
FOR EVENT window~restore OF dialog_window
IMPORTING status sender.
ENDINTERFACE.