How to select/focus a specific button in a messagebox?


I have various message boxes that show on button presses and need to focus between the buttons inside of those message boxes. I need to be able to do this (or just not use message boxes…) due to no touch screen or mouse capabilities. Hardware button navigation only (that part is working fine everywhere else in the application and when message boxes open, just cannot focus objects inside message boxes).

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


What do you want to achieve?

Select/focus a button inside of a message box.

What have you tried so far?

Using the lv_group_focus_obj with my message box group.

Code to reproduce

Cannot add code. I am simply making a message box with two buttons (that part works fine, and I can focus the box itself).

Screenshot and/or video

Cannot upload screenshots.


It should work automatically. If you focus on a message box with lv_obj_focus(mbox) (mbox needs be in a group) you should be able to navigate among the buttons.

Take a look at this tutorial:

Or this live demo: