Skip to main content

ControlEdit

The ControlEdit class provides a user interface control for text input, supporting various modes like plain text, password, numeric, and hexadecimal input. It allows for customizable features like frame and background visibility, edit color, and password code. The class supports multiple text selection and manipulation functionalities, including setting and getting the current index, selection, and selected text. It also allows interaction through callbacks for events such as clicks, changes, and text returns. Additionally, the control can be updated based on keyboard input, enabling real-time interaction in user interfaces. Ideal for scenarios that require dynamic text input and modification, such as forms or password fields.

#include <interface/TellusimControls.h>

Inheritance

Constructors

ControlEdit()
explicit ControlEdit(Control *parent)
ControlEdit(Control *parent, const char *text)
ControlEdit(Control *parent, const String &text)

Methods

Frame flag.

void setFrame(bool frame)
bool getFrame() const

Background flag.

void setBackground(bool background)
bool getBackground() const

Edit color.

void setEditColor(Color color)
const Color getEditColor() const

void setEditMode(EditMode mode)
EditMode getEditMode() const

Password code.

void setPasswordCode(uint32_t code)
uint32_t getPasswordCode() const

Edit codes.

uint32_t getNumCodes() const
const uint32_t *getCodes() const

Current index.

void setCurrentIndex(uint32_t index, uint32_t selection_index = Maxu32)
uint32_t getCurrentIndex() const
uint32_t getSelectionIndex() const

Selected text.

void setSelection(bool current = false, bool changed = false)
void clearSelection()
String getSelectedText() const

Update control.

bool updateKeyboard(ControlRoot &root, uint32_t key, uint32_t code)

Clicked callback.

void setClickedCallback(const ClickedCallback &func)
ClickedCallback getClickedCallback() const
bool isClicked()

Changed callback.

void setChangedCallback(const ChangedCallback &func)
ChangedCallback getChangedCallback() const
bool isChanged()

Returned callback.

void setReturnedCallback(const ReturnedCallback &func)
ReturnedCallback getReturnedCallback() const
bool isReturned()

Canvas elements.

CanvasMesh getCanvasMesh()

Types

using ClickedCallback = Function<void(ControlEdit)>
using ChangedCallback = Function<void(ControlEdit)>
using ReturnedCallback = Function<void(ControlEdit)>

Enums

EditMode

Edit mode.

NameValue
EditModeText0
EditModePassword1
EditModeNumber2
EditModeSigned3
EditModeUnsigned4
EditModeHexadecimal5