Understanding how navigation works with a rotary encoder


Trying to understand navigation using a rotary encoder and a tile view

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

the simulator

What do you want to achieve?

understand how the navigation is meant to work and use it that way

What have you tried so far?

I have created a tile view with several tiles. Each tile has a button on it.
I want to be able to rotate to a tile, press enter (on the encoder), enter the tile and give focus to the button. Rotate the encoder to change the value of the button and then long press to give focus back to the tile.
I have most of the code implemented to do this but i feel i maybe overthinking my solution
So I have a couple of questions
1: Is it expected that you can have an object in focus but not showing on the display? E.g. when a tile is given focus, I manually move it into the visible part of the display using the on_Focus event from the tileview.
2: When I select a tile by pressing enter, i remove all the objects from my group and add only the objects in the focused tile to the group, when i leave the tile, i remove all the objects from the group and then add just the tiles to the group. Is this the correct process?
3: When using a rotary encode for navigation, i can switch between navigation and edit mode by calling the lv_group_set_editing function. Is there any time when littleVGL does this automatically?


Code to reproduce

Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.

The code block(s) should be formatted like:

/*You code here*/

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.

1 Like

Your approach seems correct.

However, you don’t need to change between edit and navigate mode manually. LVGL does this on widgets where there is something to edit. E.g. a slider’s value.

If you already use the focus callback, you can check which tile became focused and set its tile in the tileview.

Would you show your codes here?