Forms

Forms are simply collections of widgets. You group individual widgets together into a logical single entity (Form) and then render the form instead of the individual widgets. It is possible to assign the same widgets to multiple forms.

Helper functions in the Form class allow you to assign event callbacks to all the members of the form in one go.

Examples:

Create a form:

Form myForm(3, &widgetOne, &widgetTwo, &widgetThree);

The first parameter of any form creation is the number of widgets the form has (it must equal the total number of the rest of the arguments).

All subsequent arguments are pointers to Widget objects.

Render a form:

myForm.render();

Yes, it really is a simple as that.

Make a form redraw:

myForm.redraw();

Assign a callback to all widgets in a form:

myForm.onPress(myPressCallback);

All the other event functions are also available (tap, drag, etc).