Demonstrations (Cont.)


Labels
You can create a label in a form by creating a label resource. The label resource displays noneditable text or labels on a form (dialog or full-screen). It's used, for example, to have text appear to the left of a checkbox instead of the right. You don't interact with a label as a programmatic entity; however, you can use Form API to create new labels or to change labels dynamically.

Buttons
Control objects allow for user interaction when you add them to the forms in your application. Events in control objects are handled by CtlHandleEvent. There are several types of control objects such as buttons and check boxes. Buttons display a text or graphic label in a box. The default style for a button is a text string centered within a rounded rectangle. Buttons have rounded corners unless a rectangular frame is specified. A button without a frame inverts a rectangular region when pressed.

 User Action   System Response   CtlHandleEvent Response 
Pen goes down on a button.
penDownEvent with the x and y coordinates stored in EventType

Adds the ctlEnterEvent to the event queue.
 
ctlEnterEvent with button's ID number

Inverts the button's display.
Pen is lifted from button.
penUpEvent with the x and y coordinates stored in EventType

Adds the ctlSelectEvent to the event queue.
Pen is lifted outside button.
penUpEvent with the x and y coordinates stored in EventType

Adds the ctlExitEvent to the event queue.

When the user taps a button with the pen, the button highlights until the user releases the pen or drags it outside the bounds of the button. The above table shows the system events generated when the user interacts with the button and CtlHandleEvent's response to the events.