The table widget already tracks the selected cell and I’m using it to highlight the corresponding row. What I’m not aware of is how I can make the table rollover like it’s possible with spinboxes.
Do you mean if the first line selected and you press the UP
key, the last line should be selected? If so I think it’s a reasonable update. Would you like to implement it yourself and send a Pull request?
Yes, that’s what I mean. I just noticed, that the RIGHT
key also changes the selected line because I’m not handling it elsewhere. Regarding the implementation…I’m using LVGL within Zephyr and I have absolutely no idea, how I could implement it without breaking anything as Zephyr uses its own LVGL-repo.
The correct place would be somewhere around here for the line handling, but you must also define a new flag, like TABLE_ROLLOVER
. That’s something for someone who sees the broader picture. I don’t…
We can add a uint32_t rollover :1;
flag here and add an API like lv_table_set_rollover(table, true/false)
and lv_table_get_rollover(table)
By having these the line you pointed out can handle rollover.
If you feel the power I encourage you to try implementing it. Once it’s in LVGL master it will be part of Zephyr too.
Why
and not a smaller data type like uint8_t rollover :1;
?
Also one could split the behaviour into
ROLLOVER_HORIZONTAL_NO_WRAP
(left/right key at the edge will change column, but not row)ROLLOVER_HORIZONTAL_WRAP
(left/right key at the edge will change column and row = current behaviour)ROLLOVER_VERTICAL_NO_WRAP
(up/down key at the edge will change row, but not column)ROLLOVER_VERTICAL_WRAP
(up/down key at the edge will change row and column)ROLLOVER_BOTH_NO_WRAP
(up/down OR left/right key at the edge will change row OR column)ROLLOVER_BOTH_WRAP
(up/down OR left/right key at the edge will change row AND column)
That’s a lot of options. Maybe that’s way too much, but kind of necessary for LTR/RTL stuff?