I made three roller . Two with values from 0 to 9, one with values from 10 to 00 (20, 30, etc.)
as I understood using the lv_roller_set_value function, I can rotate each roller from a separate variable.
the question is how to make all three rollers rotate depending on one variable with a value from 0 to 9990p
Rollers only take text and they don’t have a notion of numbers by default. But if you have a fix 0…9 or 0…99 option-list in them you don’t need to convert from/to text with stuff like sprintf, you can use the lv_roller_set_selected() function. This is index-based, not value-based setting, but with this simple option-list starting with 0, the index value would always match with the displayed 0…9. With the 0…10…20…30… value set you’ll need to do some conversion, by dividing the variable’s value with 10 before setting the index, maybe with some rounding mechanism if the variable can take values inbetween roller options. (Or use number-to-string conversion of the variable and use text-match function to find the index, which is a more involved process but more flexible for future-changes.)
Where/when to set the rollers based on the variables? I think it’s usually enough to set the rollers when the screen loads (screen-loaded event), which is optional for normal screens where widgets keep their value, but essential if you have ‘temporary’ screens. But if it’s some counter or timer you’ll need to do the update in a timer-callback or in the main-loop with some prescaler to adjust the refresh-rate.
Thank you. it’s clear that I was trying to use the wrong command. but I am again puzzled by the roller. I rotate the roller 90 degrees. The letters also turned with the roller. How can I turn them back? also, after rotate, the roller does not match the selection area
Displaying the roller widget’s option-texts are handled internally by LVGL’s roller drawing routine, and it seems they’re always rotated together with the roller’s main part, and it seems there’s no easy way to rotate them or retain their angle separately. Maybe using callbacks for the draw-events of LVGL makes it possible, there are some examples of it (like in the button-matrix widget’s description about tweaking for custom buttons).
The selection area should really rotate with the roller, this is already known and is being solved in SquareLine Studio meanwhile AFAIK.