Previous
Contents
Next

Playing with Switches and Buttons


In this section we examine several very simple examples with switches and buttons. These examples are essentially useless, but they give an introduction to views with structured models - that is, to views that are not maintained by one single shared model, but by a collection of coordinated or uncoordinated models with well-defined responsibilities for distinct subviews.

In the terminology of MVC, a switch is the model of a visual element that has a displayable label and two distinct states: switched on and switched off. In the terminology of other user interface frameworks, this visual element is sometimes called a toggle button or simply a button. The MVC terminology uses the name 'button' for the model of a visual element that is similar to a switch, but has no state. When the visual representation of a button is pressed, the button itself triggers an action.

Most of the following examples implement a view with several switches and a button. The switches an be indivudually switched on and off, the button is used to clear (switch off) all switches.


Previous
Contents
Next