Get absolute X / Y coords of a btn in a button matrix

Description

Attempting to draw something to the screen at the position of a button in a button matrix.

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

NXP 1064 - custom.

What LVGL version are you using?

7

What do you want to achieve?

Get the X and Y coords in absolute space of the button clicked in a button matrix

What have you tried so far?

Examining the code of button-matrix, but I only see ctrl codes being sent / received to interact with the underlying lv_obj_t (the actual button).

If this feature isn’t implemented yet, I’d be surprised. This has countless uses in production UI. So hopefully we’ll see it soon if it isn’t.

I am aware that I can just grab the index of the button in the keyboard, and do a screen calculation, and manually log the pixel positions of each and every button. But this seems excessive, and costly on time.

There’s no API for it, but I think you could access the coordinates using ((lv_btnmatrix_ext_t *)lv_obj_get_ext_attr(btnm))->button_areas[index].

Why do you need to get the position of the button itself?

Sorry for the late reply.

Most keyboards have features that display the key you just typed (apple, android basic kbs) for a short period of time right above the key you clicked, but larger and more apparent. This helps discover typos without having to look at the keyboard/textarea constantly.