Unable to add a successful event for Scroll in Squareline studio for Arduino GIGA R1

What do you want to achieve?

I have a small project created in SquareLine Studio for Arduino GIGA display R1 board.
in the square line studio, I have 1 roller (name = EcuSelection)
I want to achieve that if I scroll the roller from the screen I shall get selected index in the event handler.

What have you tried so far?

event added as,
lv_obj_add_event_cb(ui_EcuSelection, EcuSelection_event_handler, LV_EVENT_SCROLL, NULL);

static void EcuSelection_event_handler(lv_event_t * e)
lv_event_code_t code = lv_event_get_code(e);
lv_obj_t * obj = lv_event_get_target(e);
uint32_t get_selected = lv_roller_get_selected(obj);
Serial.print (“EcuSelection = 0x”) ;
Serial.println (get_selected) ;



As soon as I compile the sketch and upload into the Arduino board, scroller and touch screen works fine but after rolling a roller the event handler do not call automatically and hence I can’t get roller index.

for example, if I do same thing for button, then complete interface works fine.
need help to make roller working to get its index.

Screenshot or video


  • SquareLine Studio version:

  • Operating system:
    MAC Os Sonoma version 14.5

  • Target hardware:
    MAC book Air

In your lv_obj_add_event_cb callback you should not use LV_EVENT_SCROLL for requesting the selected roller option but the LV_EVENT_VALUE_CHANGED or LV_EVENT_ALL in your usage scenario. (Btw you can set this event right in SquareLine Studio, no need to code the creation of the callback and the callback itself in code, just the content of the preferably used CALL_FUNCTION SquareLine action’s callback in ui_events.c)

Thank you very much, call function event working absolutely fine.
small topic, after adding call function event one by one, the code added for previous function is getting clear from ui_events.c file after Export → Create template Project

is there any step I am doing wrong?

Vaibhav Patil