Description
I need to create time setter. I have a hardware keyboard with digits and arrows.
The text of time is like
10:10:10
A user can navigate though the text with arrows. Then he push the key with a digit and the character under the cursor should change.
What MCU/Processor/Board and compiler are you using?
Stm32H7
GCC-9.2.1
What LVGL version are you using?
7.6.1
What do you want to achieve?
I need a text area with fixed length and ability to replace characters under cursor.
What have you tried so far?
I have tried to catch LV_EVENT_INSERT. But any manipulations to the text area lead to nothing, crash or infinite loop.
lv_ta_set_insert_replace - nothing, because lv_textarea_set_max_length is set and text is full
lv_textarea_set_text - crash
lv_textarea_del_char and lv_textarea_del_char - infinite loop
Code to reproduce
void create()
{
ta = lv_textarea_create(scr, nullptr);
lv_textarea_set_text(ta, "10:10:10");
lv_textarea_set_max_length(ta, 8);
lv_obj_set_event_cb(ta, event_handler);
}
void event_handler(lv_obj_t * obj, lv_event_t event)
{
if(event == LV_EVENT_INSERT)
{
lv_textareaa_set_insert_replace(obj);
}
}