From 6ab9812450f8b8fcf05dbd60dc566cea892d05e4 Mon Sep 17 00:00:00 2001 From: Erich Hoover Date: Sun, 7 Feb 2010 10:08:38 -0700 Subject: [PATCH] hhctrl.ocx: Allow ListView navigation with the Return/Enter key. --- dlls/hhctrl.ocx/help.c | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/dlls/hhctrl.ocx/help.c b/dlls/hhctrl.ocx/help.c index e8121e79102..e115da1823b 100644 --- a/dlls/hhctrl.ocx/help.c +++ b/dlls/hhctrl.ocx/help.c @@ -487,8 +487,20 @@ static LRESULT CALLBACK Child_WndProc(HWND hWnd, UINT message, WPARAM wParam, LP case TVN_SELCHANGEDW: return OnTopicChange(info, (void*)((NMTREEVIEWW *)lParam)->itemNew.lParam); case NM_DBLCLK: - if(info->current_tab == TAB_INDEX) + if(info && info->current_tab == TAB_INDEX) return OnTopicChange(info, (void*)((NMITEMACTIVATE *)lParam)->lParam); + case NM_RETURN: + if(info && info->current_tab == TAB_INDEX) + { + HWND hwndList = info->tabs[TAB_INDEX].hwnd; + LVITEMW lvItem; + + lvItem.iItem = (int) SendMessageW(hwndList, LVM_GETSELECTIONMARK, 0, 0); + lvItem.mask = TVIF_PARAM; + ListView_GetItemW(hwndList, &lvItem); + OnTopicChange(info, (void*) lvItem.lParam); + } + return 0; } break; } @@ -910,7 +922,9 @@ static LRESULT CALLBACK PopupChild_WndProc(HWND hWnd, UINT message, WPARAM wPara { case WM_NOTIFY: { NMHDR *nmhdr = (NMHDR*)lParam; - if(nmhdr->code == NM_DBLCLK) { + switch(nmhdr->code) + { + case NM_DBLCLK: { HHInfo *info = (HHInfo*)GetWindowLongPtrW(hWnd, GWLP_USERDATA); IndexSubItem *iter; @@ -923,6 +937,23 @@ static LRESULT CALLBACK PopupChild_WndProc(HWND hWnd, UINT message, WPARAM wPara ShowWindow(info->popup.hwndPopup, SW_HIDE); return 0; } + case NM_RETURN: { + HHInfo *info = (HHInfo*)GetWindowLongPtrW(hWnd, GWLP_USERDATA); + IndexSubItem *iter; + LVITEMW lvItem; + + if(info == 0) + return 0; + + lvItem.iItem = (int) SendMessageW(info->popup.hwndList, LVM_GETSELECTIONMARK, 0, 0); + lvItem.mask = TVIF_PARAM; + ListView_GetItemW(info->popup.hwndList, &lvItem); + iter = (IndexSubItem*) lvItem.lParam; + NavigateToChm(info, info->index->merge.chm_file, iter->local); + ShowWindow(info->popup.hwndPopup, SW_HIDE); + return 0; + } + } break; } default: -- 2.11.4.GIT