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. | |
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. | |
void | enterField (bool reverse) |
Enters the field due to form navigation. | |
const String & | value () const |
Returns the text value that is currently displayed by this field. | |
void | setValue (const String &value) |
Sets the text value that is displayed by this field. |
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:
TextField timeField(mainForm, "Time since reset", "0"); void loop() { timeField.setValue(millis() / 1000); mainForm.dispatch(lcd.getButton()); }
For writable fields, use BoolField, IntField, or TimeField.
Definition at line 28 of file TextField.h.
TextField::TextField | ( | const String & | label | ) | [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.
void TextField::enterField | ( | bool | reverse | ) | [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.
const String & TextField::value | ( | ) | const [inline] |
Returns the text value that is currently displayed by this field.
Definition at line 35 of file TextField.h.