Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: how to receive WM_KEYDOWN messages from my ui_element? (Read 2547 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

how to receive WM_KEYDOWN messages from my ui_element?

Hi,

Is there a way to receive WM_KEYDOWN (or WM_CHAR, or something along those lines) from my ui_element? I've tried adding MSG_WM_KEYDOWN to my MSG_MAP but the KEYDOWN messages do not seem to get to my ui_element. I imagine that foobar is not "routing" them. Is there a way to make this work?

My use case is like this: I have a bunch of vertical scrollbars in my ui_element that I would like to control via keyboard when my ui_element has focus (e.g. Q & A for up & down of first scrollbar, W & S for the second, E & D for the third, etc)
I imagine I could register a bunch of menu items and set them via preferences -> keyboard shortcuts, but is there a better way to do it?

Thanks!

 

how to receive WM_KEYDOWN messages from my ui_element?

Reply #1

You might need to provide OnGetDlgCode to ensure that you receive all the needed keycodes, see
https://github.com/ssalonen/foo_queueconten...nts/listbox.cpp
https://github.com/ssalonen/foo_queueconten...tents/listbox.h

for an example. Also are you sure you have the focus in your ui component? I think I needed to call SetFocus in OnKeyDown of my list box element (see listbox.cpp)