Force focus to another object using code


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?


What LVGL version are you using?


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);


 lv_obj_add_state(ui_LabelTestTimeValue, LV_STATE_FOCUSED);

Screenshot and/or video

this short video shows the problem