summaryrefslogtreecommitdiff
path: root/src/modules/findadd
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-12-21 12:35:17 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-12-21 12:35:17 +0000
commit55148988e8302c760e84319811b903906d716acd (patch)
tree5d753233d6d2402d8e64b28ea3aa900c55faa190 /src/modules/findadd
parentc38ee02b8458484ce9ab752229a8282417816aa1 (diff)
fixes ticket #485: Not possible to leave the advanced search dialog with keyboard
git-svn-id: http://svn.miranda-ng.org/main/trunk@7317 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/findadd')
-rw-r--r--src/modules/findadd/findadd.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/modules/findadd/findadd.cpp b/src/modules/findadd/findadd.cpp
index 9bc9b73ec8..4472116d2b 100644
--- a/src/modules/findadd/findadd.cpp
+++ b/src/modules/findadd/findadd.cpp
@@ -192,6 +192,26 @@ static void StopThrobber(HWND hwndDlg, FindAddDlgData *dat)
InvalidateRect( GetDlgItem(hwndDlg, IDC_STATUSBAR), NULL, FALSE);
}
+static LRESULT CALLBACK AdvancedSearchDlgSubclassProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ if (msg == WM_COMMAND) {
+ HWND parentHwnd = GetParent(hwndDlg);
+ switch(LOWORD(wParam)) {
+ case IDOK:
+ SendMessage(parentHwnd, WM_COMMAND, MAKEWPARAM(IDOK, BN_CLICKED), (LPARAM)GetDlgItem(parentHwnd, IDOK));
+ SetFocus(GetDlgItem(parentHwnd, IDC_ADVANCED));
+ break;
+
+ case IDCANCEL:
+ CheckDlgButton(parentHwnd, IDC_ADVANCED, BST_UNCHECKED);
+ SendMessage(parentHwnd, WM_COMMAND, MAKEWPARAM(IDC_ADVANCED, BN_CLICKED), (LPARAM)GetDlgItem(parentHwnd, IDC_ADVANCED));
+ SetFocus(GetDlgItem(parentHwnd, IDC_ADVANCED));
+ break;
+ }
+ }
+ return mir_callNextSubclass(hwndDlg, AdvancedSearchDlgSubclassProc, msg, wParam, lParam);
+}
+
static void ShowAdvancedSearchDlg(HWND hwndDlg, FindAddDlgData *dat)
{
char *szProto = (char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCURSEL, 0, 0), 0);
@@ -201,6 +221,8 @@ static void ShowAdvancedSearchDlg(HWND hwndDlg, FindAddDlgData *dat)
if (dat->hwndAdvSearch == NULL) {
RECT rc;
dat->hwndAdvSearch = (HWND)CallProtoServiceInt(NULL,szProto, PS_CREATEADVSEARCHUI, 0, (LPARAM)hwndDlg);
+ if(dat->hwndAdvSearch != NULL)
+ mir_subclassWindow(dat->hwndAdvSearch, AdvancedSearchDlgSubclassProc);
GetWindowRect( GetDlgItem(hwndDlg, IDC_RESULTS), &rc);
SetWindowPos(dat->hwndAdvSearch, 0, rc.left, rc.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE);
}