Force focus to another object using code

Description

Is there a way to programmatically change the focus, or defocus an object (not in a group)?

(exactly what I am trying to do, and a short video, below)

What MCU/Processor/Board and compiler are you using?

ESP32

What LVGL version are you using?

8.3.6

What do you want to achieve?

I have a nice UI built with a textArea and a hidden keyboard. The keyboard is unhidden when the user clicks on the textArea. I am hiding the keyboard and moving the textArea after the done (checkmark) key is clicked on the keyboard. So far, so good. Now if the user wants to re-enter the textArea, just clicking on the textArea does nothing. The user first has to click outside the textArea and then click in the textArea in order to bring the focus back to the textArea so they can change the text.

Since I have a function which processes the input once the user presses the done (checkmark) key, is there an lgvl command I can use to put the focus somewhere else (like just on the screen) so if the user wants to click on the textArea the focus will go to the textArea and my events will be triggered (without the user having to first click outside the textArea)?

This seems like a basic thing to do, and surely I am missing a fundamental principle here, so THANK YOU for your consideration in helping out here.*

What have you tried so far?

Searched until I could search no more. (There is a restaurant at the end of the internet… also)

 lv_obj_clear_state(ui_TextAreaEmailAddress, LV_STATE_FOCUSED);

and

 lv_obj_add_state(ui_LabelTestTimeValue, LV_STATE_FOCUSED);

Screenshot and/or video

this short video shows the problem

1 Like

We too have this same problem.

Each object is in a group, so the focus of the object is made over the group

Hello, u need to check:
void lv_group_focus_obj(lv_obj_t * obj)

I had the same problem and it solved for me!
I guess in ur situation u need to use:
lv_group_focus_obj( ui_LabelTestTimeValue);