- const bool isAltDown = ::GetKeyState(VK_MENU) < 0;
- WXLPARAM lParam = (isAltDown ? KF_ALTDOWN : 0) << 16;
-
- WXWPARAM wParam = info->wVKey;
-
- int keyCode = wxCharCodeMSWToWX(wParam);
- if ( !keyCode )
- {
- // wxCharCodeMSWToWX() returns 0 to indicate that this is a
- // simple ASCII key
- keyCode = wParam;
- }
-
- wxTreeEvent keyEvent(wxEVT_COMMAND_TREE_KEY_DOWN, this);
- keyEvent.m_evtKey = CreateKeyEvent(wxEVT_KEY_DOWN,
- keyCode,
- lParam,
- wParam);
-
- if ( HandleTreeEvent(keyEvent) )
- {
- return true;
- }
-
- wxTreeItemId item = wxTreeItemId(TreeView_GetSelection(GetHwnd()));
-
- // a separate event for Space/Return
- if ( !wxIsCtrlDown() && !wxIsShiftDown() && !isAltDown &&
- ((info->wVKey == VK_SPACE) || (info->wVKey == VK_RETURN)) &&
- item )
- {
- wxTreeEvent activatedEvent(wxEVT_COMMAND_TREE_ITEM_ACTIVATED,
- this, item);
- (void)HandleTreeEvent(activatedEvent);
- }
-
- return false;
+ return MSWHandleTreeKeyDownEvent(
+ info->wVKey, (wxIsAltDown() ? KF_ALTDOWN : 0) << 16);