Trigger an event in Sqaureline based on a Value


All the trigger criteria in Squareline for adding an event is based on touch events. Is there anyway we could trigger a function based on a value (for example slider value) or timer?

For example, Remove hidden flag for a panel after 5 seconds. or when the slider value is 10.


I’m fairly certain there is no timer functionality for SquareLine, you would have to implement something like this in lvgl itself.

For the slider value, there is a trigger called VALUE_CHANGED. You could use this to call a custom function under the “action” setting, in this custom function you could read out the value in the slider and change the hidden flag there.

1 Like

Thanks for taking the time.
I did try VALUE_CHANGED. But that is only when the value changes(which is the same as a click) not based on a specific value. VALUE_CHANGED to me works the same way as Clicked.
I was looking for some Value condition (==, >, <).


Sadly there is no functionality for this as far as I know. I think the simplest option would be calling a custom function on VALUE_CHANGED and comparing a value there.

In the files generated by SquareLine there should be a new file called ui_events.c. Here you can find the custom function defined as void myCustomFunction(lv_event_t * e).

using the lv_event_get_target(e) function you get an lv_obj_t* to the LVGL object that caused the event.

From here you can use lv_slider_get_value(target) to retrieve the value in the slider and compare it to some required value.