Code event methods
- Last Updated: January 22, 2024
- 1 minute read
- OpenEdge
- Version 12.2
- Documentation
As described in Create event subscriptions, the quickest way to define an event method is to subscribe to the event by double-clicking in the Design Canvas or the Events tab. When you do this, you are taken to the automatically generated event-handling method in the ABL code, which is similar to the following:
METHOD PRIVATE VOID ultraButton1_Click ( sender AS System.Object, e AS System.EventArgs ):
END METHOD.
Add the appropriate event-handling code inside the method definition block.
The double-click technique minimizes typing and mistakes, but you can also use the
Properties view to associate any method with an event. On
the Events tab, click in the value cell to the right of the
event name. The down-arrow button that appears lets you select from a drop-down list
of all methods defined in the source code whose signature matches that of the
selected event. Alternatively, you can type a method name in the cell.
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.
You can change the name of the event handler method by editing the value on the Events tab. The change is reflected in the source code.