I have noticed that when having both a click and a long-pressed call-back event on the same button the click event fires upon button release, even if the long press was fired before (due to a long press). Is that by design?
I need only one event to fire at a time. Meaning the clicked event fires when clicked and the long press event fires when long pressed. If the current behavior is by design? Is there a way to avoid the click event after a long press?
I believe that is the intended behaviour. I am sure @kisvegabor will correct me on this if I am wrong.
For your application can you use the LV_EVENT_PRESSED event for a short press and the LV_EVENT_LONG_PRESSED for a long press and just ignore the LV_CLICKED_EVENT?
Do you think this will work for your requirement?
This is the way I do things in my own applications.
Just tried your suggestion. However, this causes the pressed event to fire just before the long-pressed event. So, I guess both events are still firing – just in reverse order.
I am trying to control a light bulb using 2 buttons. One button should turn on the light on a click / press and dim up the light upon long press. The other button would turn off the light on a click / press and dim down the light on long press.
The immediate problem, with the current behavior, is that the light will turn off either before dimming down or right after, depending on click or pressed implementation.
Looks like 6.0 was the release where clicked was changed to included both short and long presses and a separate short click event was added. It still works this way for all indevs.
Maybe missunderstand, i ask if lvgl have own code for this or callbacks indev need user write all code for determine this events.
I for example for indev encoder send only PR state and mean no your listed events is generated.