Checkboxes

The VBTKit buttons (switches) Quick, Trill and Drag all detect different kinds of user actions. The visual feedback of these buttons can be controlled by using different kinds of FeedbackVBT's.

The program Checkbox.m3 shows how to implement a check box using BooleanVBT and MarginFeedbackVBT. There are three kinds of margin feedback, so there are three constructors NewBox, NewCheck, and NewBullet. The first one will cause a check box to be displayed, the second one will display a check mark, and the third will display a bullet. Their children are usually a TextVBT that displays a label for the item. In Checkbox a checkbox is created using NewBox. Its child is a ShadowedFeedbackVBT. And its child is the text for the label. The checkbox is a child of a BiFeedbackVBT which in turn is a child of a switch VBT, which in turn is a child of BooleanVBT. The boolean VBT maintains the on/off state of the switch. When the state is changed (by pressing the button) a callback is invoked. In the program Checkbox.m3 the subprocedure Check is called which changes the label of the button for ``Check'' to ``Uncheck'' and back. Four views of the application are shown in the following images: