The BindTextInput class represents a text input UI element for use with BindCanvas. More...
#include <BindTextInput.hpp>
Public Member Functions | |
BindTextInput () | |
Constructs a BindTextInput with default properties. | |
BindTextInput (int16_t x, int16_t y, uint8_t cmdId, const char *text, const char *hint, int16_t fontSize, int32_t textColor=0, int32_t backColor=0, uint8_t widthChars=0, bool numberOnly=false) | |
Constructs a BindTextInput with custom properties. | |
void | setCallback (void(*callback)(const char *, uint8_t)) |
Set the Callback function for the text input. | |
void | invokeCallback (const char *val, uint8_t length) |
void | setText (const char *cstr) |
Sets the text content for the text input. | |
void | setText (const char *cstr, int length) |
void | setHint (const char *cstr) |
Sets the hint text for the text input. | |
const char * | getText () const |
uint16_t | getBytes (uint8_t *out) override |
Retrieves the bytes representing the text input for synchronization. | |
Public Attributes | |
int16_t | x |
X-coordinate position of the text input. | |
int16_t | y |
Y-coordinate position of the text input. | |
uint8_t | cmdId |
Command ID for the text input. | |
int16_t | fontSize = 18 |
Font size for the text input. | |
int32_t | textColor = WHITE |
Text color for the text input. | |
int32_t | backColor = TRANSPARENT |
Background color for the text input. | |
uint8_t | widthChars |
Width of the text input in characters. | |
bool | numberOnly = false |
char * | text = nullptr |
Text content of the text input. | |
![]() | |
int16_t | tag |
The BindTextInput class represents a text input UI element for use with BindCanvas.
BindTextInput is a class that defines a text input UI element that can be used within BindCanvas-based applications. It inherits from the BindView class and provides functionality to create and customize text inputs, including setting text, hint, positions, font size, text color, and background color.
BindTextInput::BindTextInput | ( | ) |
Constructs a BindTextInput with default properties.
This constructor creates a BindTextInput with default properties.
BindTextInput::BindTextInput | ( | int16_t | x, |
int16_t | y, | ||
uint8_t | cmdId, | ||
const char * | text, | ||
const char * | hint, | ||
int16_t | fontSize, | ||
int32_t | textColor = 0 , |
||
int32_t | backColor = 0 , |
||
uint8_t | widthChars = 0 , |
||
bool | numberOnly = false |
||
) |
Constructs a BindTextInput with custom properties.
This constructor creates a BindTextInput with custom properties provided as parameters.
x | X-coordinate position of the text input. |
y | Y-coordinate position of the text input. |
tag | Tag identifier for the text input. |
cmdId | Command ID for the text input. |
text | Initial text content of the text input. |
hint | Hint text for the text input. |
fontSize | Font size for the text input. |
textColor | Text color for the text input. |
backColor | Background color for the text input. |
widthChars | Width of the text input in characters. |
numberOnly | Whether the text input should accept only numbers. |
|
overridevirtual |
Retrieves the bytes representing the text input for synchronization.
This function is used to gather the bytes that represent the text input's properties for synchronization.
out | A pointer to the output buffer where the text input data will be stored. |
Reimplemented from BindView.
|
inline |
Set the Callback function for the text input.
This callback function is called when the text input value is changed. The signature of the callback function should be like:
callback |
|
inline |
Sets the hint text for the text input.
This function allows you to set the hint text for the text input UI element.
cstr | A pointer to the character array representing the hint text. |
|
inline |
Sets the text content for the text input.
This function allows you to set the text content for the text input UI element.
cstr | A pointer to the character array representing the text content. |