Understanding the WinStudio for event model

There are two kinds of form events that can be generated in WinStudio.

Remarque:  This topic presents information about the WinStudio form event model, as opposed to the Application Event system. The primary difference between the two is that form events are operational only within a single form, whereas application events can be used application-wide.

First, standard events for forms are generated automatically as the user interacts with the WinStudio ("smart") client.

Second, custom events can be created by the application developer and generated, based on specified conditions.

By themselves, events do not perform work. They simply notify WinStudio that something has happened. The actual work is performed by event handlers. Event handlers define units of work (that is, responses) that are associated with a specific event type. The work is executed whenever an event of that type is generated.

WinStudio provides built-in responses for most standard events. It also provides tools for creating custom events and event handlers. You can create custom event handlers for all standard and custom events.

There are two basic reasons that you might want to create event handlers:

  • To handle the very simple and very common case of performing some work based on an action by the user.

    For instance, you might want to launch a form or call a method when a button is clicked. In this case, you would create a custom event associated with the button and create an event handler that performs the required work in response to the event. There are a variety of response types that can be used, including the execution of methods and scripts.

  • To override the standard WinStudio behavior.

    In these cases, you might want to add some processing and/or cancel the default processing that happens in response to a particular standard event. These adjustments can be easily accomplished by creating event handlers for the standard event.

Rubriques liées