Update slider range after initial set up, what happened to lv_task_t?

I want to update/change the range of a slider after initial set. LVGL v7 suggest that this can be done using by creating a task (lv_task_t * myTask) with a task periodic task call back. But I can find no reference to this in the V8 documentation. So my question is how do change the range of a slider after initial set. The min and max range values are in this case set by the user with a pair of rollers with the change of value event initiating the update of the slider range.

Thank you for your suggestions.

Hey, you tried to use the set range value?

Actually I can change the range, the problem was that my image button event is not working which was used to make the change in the range.

lv_obj_add_event_cb(ui_BTN_Setmax, event_ui_BTN_Setmax, LV_EVENT_VALUE_CHANGED, NULL);

with the call back

static void event_ui_BTN_Setmax(lv_event_t * e)
{
lv_event_code_t code = lv_event_get_code(e);
Serial.println(“pressed”);
}

The call back is not happening on the button press. Any ideas why does an image button work differently to a normal button

Thank you

Actually I can change the range, the problem was that my image button event is not working which was used to make the change in the range.

lv_obj_add_event_cb(ui_BTN_Setmax, event_ui_BTN_Setmax, LV_EVENT_VALUE_CHANGED, NULL);

with the call back

static void event_ui_BTN_Setmax(lv_event_t * e)
{
lv_event_code_t code = lv_event_get_code(e);
Serial.println(“pressed”);
}

The call back is not happening on the button press. Any ideas why does an image button work differently to a normal button

Thank you

Without more of the code i cant help much, but you can try to change the event filtering to all

                                                         /*      thisguy    */
lv_obj_add_event_cb(ui_BTN_Setmax, event_ui_BTN_Setmax, LV_EVENT_VALUE_CHANGED, NULL);

to

lv_obj_add_event_cb(ui_BTN_Setmax, event_ui_BTN_Setmax, LV_EVENT_ALL, NULL);

I`m pretty sure that will work, i normally use the LV_EVENT_CLICKED to filter my buttons, but just to be sure use the all flag and filter inside the cb.

Edit: also are you adding the btn to the keygroup??

Thanks

I also had to add
lv_obj_add_flag(ui_BTN_Setmax, LV_OBJ_FLAG_CLICKABLE )

1 Like