|
Demos
Defining Event Subscriptions and Event
Handlers (Part 1)
Note: The OpenEdge Release 10.2B demos have not been updated for OpenEdge Release 11.0. Since
10.2B, OpenEdge Architect has been renamed as Progress Developer Studio for OpenEdge. In addition,
OpenEdge Release 11.0 includes some feature enhancements and other changes. Despite the differences
between 10.2B and 11.0, the demos are still a useful introduction to Progress Developer Studio for
OpenEdge.
|
A UI control typically recognizes many
events, but the application responds only to the ones it subscribes to.
Most controls and forms have a default
event. For example, the default for a button control is the Click event,
and the default for a form object is the Load event.
- To subscribe to an object's default event - Double-click the object on the
Design Canvas.
- To subscribe to any event - Select the object on the Design
Canvas and double-click the event name on the
Events tab in the Properties
view.
When you double-click in either of these ways, the Visual Designer generates the
appropriate SUBSCRIBE statement in the source code. It also generates an event-handling
method. Progress Developer Studio for OpenEdge automatically opens the class file in the
ABL Editor (or switches to it if it is already open) and positions the cursor at the
method definition.
Note: If you wish, you can disable the automatic generation of event
code at the Visual Designer Preferences page. Select and uncheck the Generate event handler on
double-click option.
Unsubscribing to events
To delete an event subscription, simply delete the value (the method name) that appears
for the event in the right column of the Events tab in the
Properties view.
By default, deleting this event value removes the event-handling method,
as well as the event subscription, from the ABL code. If you want to change
this behavior so that the method is retained, you can do so either for
all events or for specific selected events.
- To keep all event-handling methods when the corresponding subscription is
deleted - Go to the Visual Designer Preferences
page and clear the check box labeled Remove event
handlers when no longer needed.
- To protect a specific event-handling method from deletion - Locate the method
declaration in the ABL source code. Immediately preceding the method, an
annotation appears: @VisualDesigner. Delete this line.
Note: Do not change or delete any other annotations added to the ABL code by the Visual
Designer. The line preceding an event-handling method is the only Visual Designer
annotation that you should modify.