6.3. Implementing the Event Callback Routines

Our implementation is driven by three user-initiated events:

1.
The entry of text into the text box.
2.
The clicking of the OK button signaling that entry is complete.
3.
The clicking of the Quit button to terminate the application.

The methods we implement to respond to these events are referred to as callbacks or event handlers. There are two steps to implementing event handlers: Writing the code, of course, is the first step. The second step is registering the callback function with the control widget through which the event occurs. For our program, the three controls are the text box and the two buttons.

When we double-click on the control—for example, the text box—the designer generates the ...

Get C# Primer: A Practical Approach now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.