16.4. Stage 3: Adding Functionality Through Event Handling

To introduce C# GUI event handling in a gentle, stepwise fashion, we'll do so in three phases:

  • First, we'll talk about the C# event model in general.

  • Second, we'll illustrate how to tackle event handling with a simple Push Me button example.

  • Finally, we'll dive in and provide full-blown event handling for the SRS GUI.

16.4.1. The C# Event Model

GUI events are generated whenever a user interacts with an enabled object on the GUI—clicks a button, types in a field, and so on. As with virtually everything else in C#, events themselves are objects! There are many different types of events; we'll learn about several of these shortly.

When we create a GUI object, it automatically has the capability ...

Get Beginning C# 2008 Objects: From Concept to Code 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.