[v7.3] Register button in button matrix only after touch release, not button release


I have a button matrix to input a PIN.
The buttons will register if the touch is dragged. I want to avoid this behavior, as it causes unwanted inputs (watch gif - first input of pin is the expected behavior, second input is the unwanted behavior).

What MCU/Processor/Board and compiler are you using?

Simulator (Eclipse)

What LVGL version are you using?


What do you want to achieve?

Registering button input in a button matrix only if the touch was released.

What have you tried so far?

Tried to register input on release instead of press, but the result is the same.

Code to reproduce

Default button matrix on a 3x4 grid.

Screenshot and/or video



Is there anyway to know the touch status (pressed/not pressed)? Could create a registry to know if when a button is pressed there were any touch inputs in the previous (mili-)seconds.


Reading on the Porting section on the docs right now.


For clarification, here’s the physical version of the issue, might be easier to understand:

It registers button click even if I don’t lift the pen from the screen and drag it around the keyboard.


Yes, that is what I’m using. What’s happening is that LV_EVENT_CLICKED doesn’t register the release or not of the touch input.
If I drag the input (don’t lift the finger off the screen) it still registers the click, because the touch goes from one button to another. Check the gif I uploaded in the end of the post. The second input of pin I drag the input and it still registers.

I added another gif to try to clarify the issue


I thought it should work if you set LV_BTNMATRIX_CTRL_CLICK_TRIG for the buttons. However, when I tried it I’ve noticed a related bug in LVGL. I’ve just fixed in master.

It should work with this:

lv_btnmatrix_set_btn_ctrl_all(btnm, LV_BTNMATRIX_CTRL_CLICK_TRIG)