[C/C++] Win32 api TreeView

Started by
5 comments, last by helloworld123 16 years, 1 month ago
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!
Advertisement
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
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?
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...

:(
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.
@MJP - ey, do you manually call the IsDialogMessage()? where does one put it? thanks!
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.

This topic is closed to new replies.

Advertisement