ArduinoLibs
|
Field that displays a read-only text value. More...
#include <TextField.h>
Public Member Functions | |
TextField (const String &label) | |
Constructs a new text field with a specific label. More... | |
TextField (Form &form, const String &label, const String &value) | |
Constructs a new text field with a specific label and value attaches it to a form. More... | |
void | enterField (bool reverse) |
Enters the field due to form navigation. More... | |
const String & | value () const |
Returns the text value that is currently displayed by this field. More... | |
void | setValue (const String &value) |
Sets the text value that is displayed by this field. More... | |
Public Member Functions inherited from Field | |
Field (const String &label) | |
Constructs a new field with a specific label. More... | |
Field (Form &form, const String &label) | |
Constructs a new field with a specific label and attaches it to a form. | |
~Field () | |
Destroys this field and removes it from its owning Form. More... | |
Form * | form () const |
Returns the Form that owns this field; null if not associated with a Form. | |
virtual int | dispatch (int event) |
Dispatches event via this field. More... | |
virtual void | exitField () |
Exits the field due to form navigation. More... | |
const String & | label () const |
Returns the label to display in the first line of this field. More... | |
void | setLabel (const String &label) |
Sets the label to display in the first line of this field. More... | |
bool | isCurrent () const |
Returns true if this field is the currently-displayed field in its owning form; false otherwise. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from Field | |
LiquidCrystal * | lcd () const |
Returns the LCD that this field is being drawn on. | |
virtual void | updateCursor () |
Updates the cursor position after the label has been drawn by setLabel(). More... | |
Field that displays a read-only text value.
This following example displays a text field with the label "Form example" and a value() of "v1.0".
As well as static messages, TextField can be used to display read-only information that is computed at runtime:
For writable fields, use BoolField, IntField, or TimeField.
Definition at line 28 of file TextField.h.
|
explicit |
Constructs a new text field with a specific label.
The field is initially not associated with a Form. The field can be added to a form later using Form::addField().
The initial value() will be the empty string.
Definition at line 66 of file TextField.cpp.
TextField::TextField | ( | Form & | form, |
const String & | label, | ||
const String & | value | ||
) |
Constructs a new text field with a specific label and value attaches it to a form.
Definition at line 77 of file TextField.cpp.
|
virtual |
Enters the field due to form navigation.
This function is typically called when the user presses Left and Right buttons to navigate to the field. If reverse is true, then navigation was due to the Left button being pressed.
This function can assume that the display has been cleared and the cursor is positioned at (0, 0).
The default implementation prints the label().
Reimplemented from Field.
Definition at line 83 of file TextField.cpp.
void TextField::setValue | ( | const String & | value | ) |
Sets the text value that is displayed by this field.
Definition at line 102 of file TextField.cpp.
|
inline |
Returns the text value that is currently displayed by this field.
Definition at line 35 of file TextField.h.