Bind
C++ UI toolkit for Arduino
 
Loading...
Searching...
No Matches
BindTextInput Class Reference

The BindTextInput class represents a text input UI element for use with BindCanvas. More...

#include <BindTextInput.hpp>

Inheritance diagram for BindTextInput:
BindView

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.
 
- Public Attributes inherited from BindView
int16_t tag
 

Detailed Description

The BindTextInput class represents a text input UI element for use with BindCanvas.

BindTextInput

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.

Constructor & Destructor Documentation

◆ BindTextInput() [1/2]

BindTextInput::BindTextInput ( )

Constructs a BindTextInput with default properties.

This constructor creates a BindTextInput with default properties.

◆ BindTextInput() [2/2]

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.

Parameters
xX-coordinate position of the text input.
yY-coordinate position of the text input.
tagTag identifier for the text input.
cmdIdCommand ID for the text input.
textInitial text content of the text input.
hintHint text for the text input.
fontSizeFont size for the text input.
textColorText color for the text input.
backColorBackground color for the text input.
widthCharsWidth of the text input in characters.
numberOnlyWhether the text input should accept only numbers.

Member Function Documentation

◆ getBytes()

uint16_t BindTextInput::getBytes ( uint8_t *  out)
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.

Parameters
outA pointer to the output buffer where the text input data will be stored.
Returns
The number of bytes written to the output buffer.

Reimplemented from BindView.

◆ setCallback()

void BindTextInput::setCallback ( void(*)(const char *, uint8_t)  callback)
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:

void callback(const char *text, uint8_t length)
char * text
Text content of the text input.
Definition BindTextInput.hpp:131
Parameters
callback

◆ setHint()

void BindTextInput::setHint ( const char *  cstr)
inline

Sets the hint text for the text input.

This function allows you to set the hint text for the text input UI element.

Parameters
cstrA pointer to the character array representing the hint text.

◆ setText()

void BindTextInput::setText ( const char *  cstr)
inline

Sets the text content for the text input.

This function allows you to set the text content for the text input UI element.

Parameters
cstrA pointer to the character array representing the text content.

The documentation for this class was generated from the following files: