Create a SWITCH event that enables other widget

What do you want to achieve?

I have a Switch widget and I would like to add a state or states to change the Disabled state of another widget. So when the switch is ON, I would like to disable an Image Button and when the switch is OFF I would like to enable an Image Button.

I could write this in code but it would be nicer for SLS to hookup the ability automatically for me.

What have you tried so far?

I created two events one for CHECKED which adds a DISABLED state to the Image Button and one for UNCHECKED which removes a DISABLED state. However, it seems that SWITCH does not generate a checked/unchecked event.

Screenshot or video

Others

  • SquareLine Studio version:
    1.0.5
  • Operating system:
    Windows 10 x64
  • Target hardware:
    Raspberry Pi 4.

What about removing “Clickable” flag from that Image Button when switch is ON and add it when swith is OFF? Will that do what you need?

I think the problem is with the image button and LVGL. In LVGL the image button’s state should be changed with lv_imgbtn_set_state instead of the generic lv_obj_add/clear_state(). Can you try if it works with a normal lv_btn?

Yes, it seems to work fine with a normal button.

Andy

Thanks.
I need to address it in LVGL. :frowning: