ArduinoLibs
|
Manager for a form containing data input/output fields. More...
#include <Form.h>
Public Member Functions | |
Form (LiquidCrystal &lcd) | |
Constructs a new form and associates it with lcd. More... | |
~Form () | |
Detaches all remaining fields and destroys this form. | |
int | dispatch (int event) |
Dispatches event to the currently active field using Field::dispatch(). More... | |
void | nextField () |
Changes to the next field in the "tab order". More... | |
void | prevField () |
Changes to the previous field in the "tab order". More... | |
void | defaultField () |
Changes to default field (i.e., the first field). More... | |
void | addField (Field *field) |
Adds field to this form. More... | |
void | removeField (Field *field) |
Removes field from this form. More... | |
Field * | currentField () const |
Returns the current field that is displayed on-screen. More... | |
void | setCurrentField (Field *field) |
Sets the current field that is displayed on-screen. More... | |
bool | isCurrent (Field &field) const |
Returns true if field is currently displayed on-screen, false otherwise. More... | |
void | show () |
Shows the form, or does nothing if the form is already on-screen. More... | |
void | hide () |
Hides the form, or does nothing if the form is not on-screen. More... | |
bool | isVisible () const |
Returns true if the form is shown; false if the form is hidden. More... | |
Friends | |
class | Field |
Manager for a form containing data input/output fields.
See the Form example for more information on creating an application that uses forms and fields.
|
explicit |
void Form::addField | ( | Field * | field | ) |
Adds field to this form.
Usually this function is not required because the field's constructor will add the field to the form automatically.
|
inline |
Returns the current field that is displayed on-screen.
Returns null if the form has no fields, or setCurrentField() explicitly set the current field to null.
void Form::defaultField | ( | ) |
Changes to default field (i.e., the first field).
int Form::dispatch | ( | int | event | ) |
Dispatches event to the currently active field using Field::dispatch().
The event is usually obtained from LCD::getButton().
Returns zero if the event has been handled and no further action is required.
Returns FORM_CHANGED if one of the fields on the form has changed value due to the event, perhaps requiring the application to take further action based on the new field value. Use currentField() or isCurrent() to determine which field has changed.
This function handles the Left and Right buttons to navigate between fields.
void Form::hide | ( | ) |
Hides the form, or does nothing if the form is not on-screen.
The screen will be cleared to remove the contents of the current field.
|
inline |
Returns true if field is currently displayed on-screen, false otherwise.
This function is typically called after dispatch() returns FORM_CHANGED to determine which field has changed.
|
inline |
void Form::nextField | ( | ) |
Changes to the next field in the "tab order".
void Form::prevField | ( | ) |
Changes to the previous field in the "tab order".
void Form::removeField | ( | Field * | field | ) |
Removes field from this form.
If field is the current field on-screen, then either the next or previous field will be made current.
void Form::setCurrentField | ( | Field * | field | ) |
Sets the current field that is displayed on-screen.
Use this function to programmatically force the form to display a specific field on-screen.
void Form::show | ( | ) |
Shows the form, or does nothing if the form is already on-screen.
When the form is shown, the screen will be cleared and the currentField() will be drawn.
If the form was previously hidden, then the field that was previously current will be shown again. Call defaultField() before show() to reset the form to show the first field instead.