Rollover spinbox

I’m working on a screen to set clock time using spinboxes, and it would be useful to have values that would roll around the range of values.
For example, setting the hour the spin will set to 0 when incrementing 23, and will set to 23 when decrementing 0. A change to the lv_spinbox_ext_t structure might be useful to enable this behavior.

I modified increment/decrement functions this way:
Increment: changed ext->value = ext->range_max; to ext->value = ext->range_min + ext->step - 1;
Decrement: changed ext->value = ext->range_min; to ext->value = ext->range_max - ext->step + 1;

Would a signal callback be useful?

It seems like a useful improvement!

Can you send a Pull request with these updates?

Sure! Working on it :slight_smile:

1 Like