When I press the Down button the Roller works until it reaches the minimum number and then it rolls back to the max number. If I scroll UP it will reach the max number and stop. I am using LV_ROLLER_MODE_NORMAL in the
lv_roller_set_options(roller1, opts, LV_ROLLER_MODE_NORMAL);
I’ve tried the code in the PC simulator and a NUCLEO-H7A3ZIQ board
I’m using LVGL version 8.3
I need the rollers to stop scrolling when they hit the last number in the string.
The code block(s) should be formatted like:
static void event_handlerCurrent(lv_event_t* e2)
{
lv_event_code_t code = lv_event_get_code(e2);
lv_obj_t* obj2 = (lv_obj_t*)lv_event_get_target(e2);
if (code == LV_EVENT_VALUE_CHANGED) {
char buf[20];
lv_roller_get_selected_str(roller1, buf, sizeof(buf));
LV_LOG_USER("Selected Current: %s\n", buf);
}
}
static void button_down_event_handler(lv_event_t* e)
{
lv_event_code_t code = lv_event_get_code(e);
void* user_data = lv_event_get_user_data(e);
if (code == LV_EVENT_CLICKED) {
LV_LOG_USER("Clicked");
}
else if (code == LV_EVENT_VALUE_CHANGED) {
LV_LOG_USER("Toggled");
}
lv_roller_set_selected(roller1, lv_roller_get_selected(roller1) - 1, LV_ANIM_ON)
}
void lv_current_1ma_roller(void)
{
roller1 = lv_roller_create(lv_scr_act());
const char* opts = "1\n2\n3\n4\n5\n6\n7\n8\n9\n10";
lv_roller_set_options(roller1, opts, LV_ROLLER_MODE_NORMAL);
lv_roller_set_visible_row_count(roller1, 5);
lv_obj_align(roller1, LV_ALIGN_CENTER, -325, 0);
lv_roller_set_selected(roller1, 4, LV_ANIM_OFF);
lv_obj_add_event(roller1, event_handlerCurrent, LV_EVENT_ALL, NULL);
}
So, when I press the DOWN button the numbers scroll from the starting value of 5 to 1 like they should but If I press the down button one more time with the scroll at 1 it will loop around and 10 is now visible. Is this normal behavior? I am not using the INFINITE mode but teh NORMAL mode.
Thanks,
Richard