From 4e0a7e927b051e435bde39f109ccb097360d58e4 Mon Sep 17 00:00:00 2001 From: kichik Date: Fri, 17 Jan 2003 14:11:23 +0000 Subject: [PATCH] Fixed bug #660082 - Focus problems in MakeNSISw, menu shortcuts didn't work when focus was on the test button and it was disabled due to an error in the script. git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2070 212acab6-be3b-0410-9dea-997c60f758d6 --- Contrib/Makensisw/makensisw.h | 1 + Contrib/Makensisw/utils.cpp | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/Contrib/Makensisw/makensisw.h b/Contrib/Makensisw/makensisw.h index 7fb897e5..3cf3ba78 100644 --- a/Contrib/Makensisw/makensisw.h +++ b/Contrib/Makensisw/makensisw.h @@ -93,6 +93,7 @@ typedef struct NSISScriptData { HMENU menu; HMENU submenu; HANDLE thread; + HWND focused_hwnd; CHARRANGE textrange; } NSCRIPTDATA; diff --git a/Contrib/Makensisw/utils.cpp b/Contrib/Makensisw/utils.cpp index 103270e2..497a3b87 100644 --- a/Contrib/Makensisw/utils.cpp +++ b/Contrib/Makensisw/utils.cpp @@ -74,6 +74,8 @@ void ErrorMessage(HWND hwnd,const char *str) { } void DisableItems(HWND hwnd) { + g_sdata.focused_hwnd = GetFocus(); + EnableWindow(GetDlgItem(hwnd,IDC_CLOSE),0); EnableWindow(GetDlgItem(hwnd,IDC_TEST),0); EnableMenuItem(g_sdata.menu,IDM_SAVE,MF_GRAYED); @@ -86,6 +88,9 @@ void DisableItems(HWND hwnd) { EnableMenuItem(g_sdata.menu,IDM_EDITSCRIPT,MF_GRAYED); EnableMenuItem(g_sdata.menu,IDM_CLEARLOG,MF_GRAYED); EnableMenuItem(g_sdata.menu,IDM_BROWSESCR,MF_GRAYED); + + if (!IsWindowEnabled(g_sdata.focused_hwnd)) + SetFocus(GetDlgItem(hwnd,IDC_LOGWIN)); } void EnableItems(HWND hwnd) { @@ -103,6 +108,8 @@ void EnableItems(HWND hwnd) { EnableMenuItem(g_sdata.menu,IDM_EDITSCRIPT,MF_ENABLED); EnableMenuItem(g_sdata.menu,IDM_CLEARLOG,MF_ENABLED); EnableMenuItem(g_sdata.menu,IDM_BROWSESCR,MF_ENABLED); + + SetFocus(g_sdata.focused_hwnd); } void CompileNSISScript() {