Textarea
Single-line textarea with button matrix
Feed a one-line textarea from a numeric button matrix.
A textarea is placed at the top in one-line mode and forced into
LV_STATE_FOCUSED so the cursor stays visible. A four-row button matrix
holds digits 0..9 plus LV_SYMBOL_BACKSPACE and LV_SYMBOL_NEW_LINE. Its
LV_EVENT_VALUE_CHANGED handler appends the pressed character, deletes on
backspace, or sends LV_EVENT_READY to the textarea on new line. The matrix
drops LV_OBJ_FLAG_CLICK_FOCUSABLE so focus stays with the textarea.
Text area cursor styling
Style the cursor part as a solid block or a thin bar.
Both text areas style the cursor part with a named style. The first fills
the cell with an opaque background for a block cursor; the second leaves the
background transparent and draws only a left border for a bar cursor — the
same part, two looks.
Auto-format HH:MM clock input
Insert the : automatically after the first two digits.
A one-line textarea restricts input to 0123456789: via
lv_textarea_set_accepted_chars and caps the length at 5. A
LV_EVENT_VALUE_CHANGED callback checks the first two characters and, once
both are digits with no colon in position 2, moves the cursor and calls
lv_textarea_add_char(':'). A numeric lv_keyboard in
LV_KEYBOARD_MODE_NUMBER feeds the textarea.
Password text area
Mask typed characters with password mode.
A one-line textarea has lv_textarea_set_password_mode enabled, so each
typed character shows briefly and then turns into a bullet. An
lv_keyboard docked at the bottom is bound to the textarea so the masking
can be tried interactively.
Text area placeholder
Show a hint while the text area is empty.
Both text areas carry the same placeholder_text. The first is left empty
so the grey hint is visible; the second has text set, which hides the
placeholder — the contrast shows exactly when the hint appears.
Last updated on