Button receives "pressed" event when another (pressed) object is withdrawn

Hello,

I have a menu-popup which hides some buttons. This menu-popup contains buttons which close this popup when they receive an LV_EVENT_PRESSED.

When the popup disappears, the finger is still on the touchscreen, so the underlying button (which is no longer hidden) immediately receives an LV_EVENT_PRESSED.

This feels very strange, because the user never intended to press the (hidden) button. All the user wanted to do was to choose some menu-entry from the popup, which in turn removes this popup and unhides the (hidden) button.

I recommend using LV_EVENT_CLICKED for buttons. It fires on release, and thus this problem won’t occur.

I see.

Are there any suggestions on when to use which type of events? I just moved from “clicked” to “pressed” because of this issue

You can use the input event list as a reference for which one gets fired when, but it depends mainly on the behavior you want for your application.

If you want to be notified the instant the button gets touched, you have to use PRESSED.

If you just want to be notified when it gets clicked, CLICKED will be more reliable in certain edge cases like the one you found.