-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[LVGL] Support groups #229
Comments
I'm finally ready to implement this feature. In the meantime a new feature request, similar to this one, has been created: #487. I'm taking into consideration what you proposed in this issue and what is proposed in #487. I want this to be as simple as possible.
Do we need another ordering? We already have an ordered list of widgets inside the page. So, we can use this also for the groups.
I'm thinking how this should be implemented. To call In screens.h:
Note: User should assign to In screens.cpp, I will generate this code:
And in the screen load event handler I will generate this code:
|
Some clarifications:
|
Another way to implement this is to leave to the user to call
So, we first remove all the objects from the group from previous screen and add a new set of object for the current screen. This means that groups are global not per page. I think this is simpler model and maybe what you originally proposed. |
I do think we need a different ordering: The order in the group dictates the order in which widgets are selected when moving between them with keys. For example: pressing the button of an encoder moves to the next widget (slider for example). It also determines the widget that is selected when the page is entered. The order in the page determines also the 'Z axis' on the screen. Combining this into a single ordering might cause impossible situations? The generated code should probably also call |
Yes, probably there are cases when you want different order.
This is not default behaviour for LVGL. If encoder is not used then why should any widget be in focus? |
You are correct. It deviates from LVGL default so it should not be default setting.
Looks fine to me: Groups are global and for each group there is a ordered list for each screen: On a screen load only the objects in the ordered list of this specific screen of this specific group are loaded into the group. This is done for every group. |
And there is an API call lv_obj_get_group(obj) to see which group an object belongs to. From this it can also be concluded that the same object can only be in one group. |
I also didn’t realize this. It might be logical from a UI perspective: how can you visualize which group (and which inputs) are active for a widget. BTW I might have missed the ‘default group’ setting for a screen? |
I think it is not very useful feature because it doesn't take care which screen is active. |
I mean, the object will remain in the default group even if its parent screen is not active anymore. |
Clear, default is not very useful for us. Your code example looks fine. I compared it to my manual implementation and noticed groups has a configurable property that might be useful:
Other properties don’t seem relevant for studio use cases I can think of. Some functions might be relevant as events you can trigger via the LVGL action. This would allow use cases where pressing a specific button (or other event) selects a certain widget for your encoder or changes the group state:
The _obj function requires an object (widget). A good complex example is a device with a row of button next to the screen and 1 generic encoder with ‘<‘ and ‘>’ keys:
|
Group ordering can be defined with the "Group index" property of the widget: This is similar to tabindex in HTML:
|
Looks great! Can’t wait to use this and remove some code. |
Yes. |
I gave it a try on real hardware with an encoder and it is working great! --delete limitation with user actions, tested it not good enough -- |
User widgets are currently not supported. I'm adding group actions in LVGL action and after that I will see how to support user widgets. |
Groups are now supported for the user widgets too. |
Are you sure you have the latest version? |
I missed a few commits. It is working now in HW and simulator! |
I've added
If
Apparently, the first way is required on LVGL 9.x otherwise focus on first group member by default will not work. |
Please add support for groups (needed for keys and encoders):
The text was updated successfully, but these errors were encountered: