Why does not keyboard navigation work with the Tree View control?
By Yaroslav Goncharov, May 08, 2003.
Question
I have the tree view control in a dialog and it
does not respond to keyboard events. On the Smartphone 2002 platform I don't have a touch screen and
a keyboard is the only way to navigate and scroll. How can I enable
keyboard navigation in the Tree View control?
Answer
Keyboard navigation messages are consumed by the dialog. There are at least 2 ways to solve the problem.
- If you can live without dialog features replace the dialog based parent by a generic window.
- Subclass a tree view control and handle WM_GETDLGCODE message:
LRESULT CALLBACK TreeViewProc(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam )
{
switch (uMsg)
{
case WM_GETDLGCODE:
return DLGC_WANTMESSAGE;
}
return CallWindowProc(OldTreeViewProc, hwnd, uMsg, wParam, lParam);
}
You can meet similiar problems with the HTML control. The both methods will work
in this case too, but you will need to
subclass an internal window of the HTML control if you choose the second approach.
See the related article for details.
Discuss
Discuss this QA.
Here you can write your comments and read comments of other developers.
|