How to disable a slider?

Is it possible to disable a slider? Buttons have an Inactive state, but I don’t see anything similar for sliders.

I thought about setting the minimum to the maximum so it has nowhere to move, but that is giving me a Floating point exception (divide-by-zero) which makes sense as I’m sure it’s dividing by the delta(min, max) to get a percentage.

1 Like

Isnt a disabled slider a bar?

lv_obj_t * bar1 = lv_bar_create(lv_scr_act(), NULL);
lv_obj_set_size(bar1, 400, 60);
lv_obj_align(bar1, NULL, LV_ALIGN_CENTER, 0, 0);
lv_bar_set_anim_time(bar1, 200);

I suppose that’s one way to do it, but it lacks the knob that makes it look like a slider. Preferably I’d have a grayed out slider that still looks like the normal, active object.

You should call lv_obj_set_click(slider, false) to make in non-clickable.

1 Like

That’s too simple a solution… :slight_smile: Thank you!

1 Like