Skip to main content
gamedev.net
🔒 Locked

[C/C++] Win32 api TreeView

Started by helloworld123 5 replies 2.1k views
Original Post
helloworld123
helloworld123
Hi, When I created a treeview using win32 API, when I press the down or up key, the selected item doesn't go up/down. I am developing under Embedded Visual C++ (for smartphone 2003). Please don't reply telling me to use VB or C#.net for smartphone 2003. Does anyone have any idea how to manually detect keypress for the treeview? And how to have the highlighted item to go up and down when user presses the up and down key? Thanks!
Anon Mike
Anon Mike
If the treeview has focus pressing the arrow keys should move the selection without you having to do anything manually. If it doesn't you're doing something wrong. My guess would be that you're not forwarding stuff to DefWindowProc when you should be but who knows.

I suppose it's also possible that the treeview implementation for smartphones is wildly different in this area than it is for normal Windows, but that seems unlikely.
-Mike
helloworld123
helloworld123
hi you're right, i don't have a defwindowproc, but the treeview is in a dialog box.

i tried DefDlgProc, but it crashes the app.

Any ideas what to use if in a dialog box?
helloworld123
helloworld123
i googled and it turns out i shouldn't be using defdlgproc in a dialog's proc...

what else could be a solution to the treeview not getting key input (up/down)?

i tried SetFocus(treeViewHwnd);...but still doesn't work...

:(
MJP
MJP
I have a Tree-View in a dialog box in my (PC) Win32 app, and it responds to keyboard input just fine. I didn't do anything fancy to make it work, it's just a modeless dialog where the parent window's message pump uses IsDialogMessage to send off messages intended for the dialog box.
helloworld123
helloworld123
@MJP - ey, do you manually call the IsDialogMessage()? where does one put it? thanks!
helloworld123
helloworld123
i got this to work now. by subclassing the tree view control, and handling the user-input manually through its own "wndproc"...(handling the VK_DOWN and VK_UP within it).

thanks anyway.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.