When pressing the left button with the mouse and swiping to an obj, do not expect to receive LV_EVENT_CLICKED. Just want the mouse click to receive LV_EVENT_CLICKED. How to do it?

When pressing the left button with the mouse and swiping to an obj, do not expect to receive LV_EVENT_CLICKED. Just want the mouse click to receive LV_EVENT_CLICKED. How to do it?

@kisvegabor

You can make the parent of the button clickable and set press lock too.

  lv_obj_add_flag(parent, LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_PRESS_LOCK);

It will make the parent “keep” the pressing.

Swiping inside an obj also does not want to trigger LV_EVENT_CLICKED.

@kisvegabor

So if you move your finger/pointer even 1 px you don’t want to get a LV_EVENT_CLICKED event?

Yes, there are some process situations where this is not desired. Whether the application can perceive LV_EVENT_CLICKED caused by sliding, the application can do targeted filtering.

You can do some custom filtering using LV_EVENT_PRESSED, LV_EVENT_PRESSING and LV_EVENT_RELEASED.

But I’d be very curious about use case when it’s important to release the exact same pixel that you have pressed.

Thank you. At present, I plan to record it when I receive LV_EVENT_PRESSED. When I receive LV_EVENT_CLICKED, compare the points when the two events of PRESSED and CLICKED occur.
image