HydrogenAudio

Hosted Forums => foobar2000 => Development - (fb2k) => Topic started by: vroomvroom on 2012-02-29 08:06:28

Title: how to receive WM_KEYDOWN messages from my ui_element?
Post by: vroomvroom on 2012-02-29 08:06:28
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!
Title: how to receive WM_KEYDOWN messages from my ui_element?
Post by: kerpondile on 2012-03-18 09:41:24

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_queuecontents/blob/master/foobar2000/foo_queuecontents/listbox.cpp)
https://github.com/ssalonen/foo_queueconten...tents/listbox.h (https://github.com/ssalonen/foo_queuecontents/blob/master/foobar2000/foo_queuecontents/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)