In this step, you will add event routines for each push button. Event routines are invoked when the user or the program triggers a specific action. You will add an event handling routine which is called when the user Clicks on each push button.
1. Select the Source. You should see code similar to the following. The Define_Com statements define the table layout, table layout items and push buttons:
2. Delete the Click event routines for the OK and Cancel buttons, which we renamed.
3. Next create an event routine (EVTROUTINE/ENDROUTINE command pair) for the Clear button to handle the "Click" event:
a. Select the Design tab and select the Clear button.
b. Right-click to show the context menu, select Events:Push Button and then the Click Event. The Source tab will be given focus and the editor will position to the new click event.
c. A Click event routine is added for the Clear push button in the Source tab as shown below:
Notice the format of the event routine Handling() keyword. An Event is defined as:
COMPONENT.EventName e.g.(#Clear.Click).
4. Next add a Click event for the Hello and World buttons.
a. On the Design tab, select the Hello button. Select the Details / Events tab and double click on the Click event to create an event handing routine. This time you will not be repositioned to the Source tab.
b. Repeat step a. to create a Click event for the World button.
Evtroutine Handling(#HELLO.Click)
Endroutine
Evtroutine Handling(#WORLD.Click)
Endroutine
Evtroutine Handling(#CLEAR.Click)
Endroutine