Try OpenEdge Now
skip to main content
GUI for .NET Programming
Accessing and Managing .NET Classes from ABL : Handling .NET events : Managing .NET events in ABL
 

Managing .NET events in ABL

The .NET event model functions as a call-back model, where the call-back is a method whose signature is defined by a specified .NET delegate. In ABL, the call-back for a .NET event can be an ABL method or an internal procedure whose signature is compatible with the signature defined for the .NET event. Like .NET, ABL uses the associated .NET delegate to validate any method or internal procedure subscribed as a handler for the event. However, ABL provides its own mechanism to subscribe the ABL routine as an event handler. The primary requirement for an ABL event handler is that the signature of the method or internal procedure must match the signature specified by the .NET delegate defined for the event. (For OpenEdge .NET events, the handler signature is included in the documentation for each event—see Defining handlers for .NET events in ABL.) The main difference between using methods and internal procedures as handlers for .NET events is that ABL verifies method event handler subscriptions at compile time (using strong typing), but verifies internal procedure event handler subscriptions only at run time.
In general, you can handle .NET events in ABL similar to how you handle ABL class events.
To handle .NET events in ABL:
1. Identify the .NET object that defines and publishes the events, and identify an ABL routine signature that is compatible with the signature defined for each .NET event. For more information, see Identifying the events published by a .NET object.
2. Write an ABL method or internal procedure as part of each class or procedure definition that you want to receive an event. For more information, see Defining handlers for .NET events in ABL.
3. Where ever your application needs to prepare for receiving an event, subscribe an appropriate method or internal procedure as a handler for the event. For more information, see Specifying handler subscriptions for .NET events.
4. At any appropriate point in your application, block for input to allow the .NET objects you are using to publish events and allow your event handlers to respond to them. In ABL, these are typically GUI for .NET events that are published while blocking on a displayed .NET form. This chapter previews the use of .NET forms. For more information, see Creating and Using Forms and Controls.
You can also do more to manage .NET events from ABL-extended .NET classes. For more information, see Managing .NET events from ABL-extended .NET classes.