Publish inherited .NET events
- Last Updated: June 19, 2019
- 1 minute read
- OpenEdge
- Version 13.0
- Documentation
Syntax
You can programmatically publish an event that an ABL-derived class inherits from a .NET
object by calling an inherited method that the .NET base class defines to publish the event.
Such inherited .NET methods for publishing events are typically defined as
protected and, by convention, have the following general method calling
sequence:
|
- EventName
- Specifies the .NET name of the event.
- eArgs
- Passes an
INPUTobject reference argument defined as aSystem.EventArgs(or a derived class, depending on the method). This is theSystem.EventArgsargument that is passed as the second parameter to any handler method for this event (see Define handlers for .NET events in ABL).
So, for example, the .NET method to publish the FormClosing event on a
Progress.Windows.Form is the OnFormClosing( ) method.
An ABL-derived class that inherits from a .NET class might need to both publish an
inherited event and perform another action at the same time. For example, you might define
an ABL BlueButton class that inherits from .NET's
System.Windows.Forms.Button. For many events, such as the
Click event, the .NET super class defines the method to fire the event as
virtual (or override). You can thus override this event
method like any other virtual method to provide additional event behavior.
However, if you override a method that .NET defines to publish an event, you must always
invoke SUPER:OnEventName( ) to publish
the event on the base class to ensure that all subscribers receive the event. You can code
your custom behavior before or after this SUPER method call, as
necessary.