[ THIS-OBJECT : | class-type-name : ]
event-name : Publish ( [ parameter [ , parameter ] ... ] ) [ NO-ERROR ]
|
[ THIS-OBJECT :
| class-type-name :
]
If event-name is a reserved keyword, you must prefix an instance
event-name with THIS-OBJECT or a static
event-name with the class type name of the current class definition. Otherwise use of these qualifiers is optional.
( [ parameter [ ,
parameter ] ... ] )
The Publish( ) method passes the same parameters to each event handler subscribed to the event. Note that any parameter results represent values returned from the last event handler to execute. However, the order of execution for event handlers is not guaranteed. Therefore, if you subscribe to multiple event handlers, you cannot be certain what event handler has returned the parameter values from the
Publish( ) method.
Suppresses ABL errors or error messages that would otherwise occur and diverts them to the ERROR-STATUS system handle. If an error occurs, the action of the statement is not completed and execution continues with the next statement. If the statement fails, any persistent side-effects of the statement are backed out. If the statement includes an expression that contains other executable elements, like methods, the work performed by these elements may or may not be completed, depending on the order in which the AVM resolves the expression elements and the occurrence of the error.
Note also, if event-name is an ABL event that implements a .NET abstract event, and you invoke a .NET method within your handler that throws an exception back to .NET, .NET generates a
System.ApplicationException that it throws back to the .NET method, which determines the result that you can manage in your handler.
You can only invoke the Publish( ) method on an event from within a class definition that defines and implements the event, regardless of the event’s access mode. (You cannot invoke
Publish( ) on an abstract event.) Thus, you can publish the event within any method, constructor, destructor, property accessor, or trigger that is defined within the class that also includes the
DEFINE EVENT statement that implements the event.
After the Publish( ) statement executes, the value of the
RETURN-VALUE function reflects the last
RETURN statement executed (if any) by all event handlers subscribed to
event-name. However, because the order of handler execution is not guaranteed, if you subscribe more than one event handler that executes RETURN, you might not know which handler set the value for the RETURN-VALUE function.