Events Do Not Propagate

I have two image buttons(A & B) that are checkable.
Each of them have a panel that is shown when they are checked and hidden when unchecked.
(If A is checked, show panel_A. If B is checked show Panel B)
This is done using an event to add/remove the hidden flag on the panel.
Part 2:
When i check one button i uncheck the other button. (changing the other buttons state)

Expected Result:
Check button A.
Check button B (causing Button A to Uncheck… which would cause A’s panel flag to change to hidden).

Actual Result:
Check button A.
Check button B (causing Button A to Uncheck … Panel A is not hidden)

Version 1.3.1

I think what you are seeing is correct: changing the state of a button does not generate an event as if it has been physically pressed.
In my opinion you should change the button state and hide the specific panel in each event handler.

I dont understand your issue for me this works

I am attempting to make each component handle its own flags when its state is changed.
In this way, i dont have to write a new event to change the flag of the component since it should be able to handle its own state changing.
(If i do have to do this, it quickly gets complex which will require many more events to change flags on all other components. Every time I add a single new object I will need to write 2 *(number of other objects) event handlers vs. just 2 for it to handle its own flags when the state changes.)
I would not expect a button press to be any different than a state change caused by another component.

When button 1 is checked, i uncheck button 2.
When button 1 is uncheck, I check button 2.

When button 2 is checked, i hide the panel.
When button 2 is unchecked, i unhide the panel.

We also see the need for a radio button feature. It would be flag, or something similarly simple to enable this functionality.

Do I understand correctly that it would solve this issue too?

I am not familiar with the term radio button, but yes that does appear to be a potential solution.
I’ve edited my response to include a video now.
I’m still under the impression this is a bug however.

Have a look at following link: Events — LVGL documentation
This suggests an event is also generated when the object’s value changes, like you are expecting.
You could raise this question on the LVGL forum to confirm this.

1 Like