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
This commit is contained in:
kichik 2003-01-17 14:11:23 +00:00
parent e38a122c1a
commit 4e0a7e927b
2 changed files with 8 additions and 0 deletions

View file

@ -93,6 +93,7 @@ typedef struct NSISScriptData {
HMENU menu; HMENU menu;
HMENU submenu; HMENU submenu;
HANDLE thread; HANDLE thread;
HWND focused_hwnd;
CHARRANGE textrange; CHARRANGE textrange;
} NSCRIPTDATA; } NSCRIPTDATA;

View file

@ -74,6 +74,8 @@ void ErrorMessage(HWND hwnd,const char *str) {
} }
void DisableItems(HWND hwnd) { void DisableItems(HWND hwnd) {
g_sdata.focused_hwnd = GetFocus();
EnableWindow(GetDlgItem(hwnd,IDC_CLOSE),0); EnableWindow(GetDlgItem(hwnd,IDC_CLOSE),0);
EnableWindow(GetDlgItem(hwnd,IDC_TEST),0); EnableWindow(GetDlgItem(hwnd,IDC_TEST),0);
EnableMenuItem(g_sdata.menu,IDM_SAVE,MF_GRAYED); 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_EDITSCRIPT,MF_GRAYED);
EnableMenuItem(g_sdata.menu,IDM_CLEARLOG,MF_GRAYED); EnableMenuItem(g_sdata.menu,IDM_CLEARLOG,MF_GRAYED);
EnableMenuItem(g_sdata.menu,IDM_BROWSESCR,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) { 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_EDITSCRIPT,MF_ENABLED);
EnableMenuItem(g_sdata.menu,IDM_CLEARLOG,MF_ENABLED); EnableMenuItem(g_sdata.menu,IDM_CLEARLOG,MF_ENABLED);
EnableMenuItem(g_sdata.menu,IDM_BROWSESCR,MF_ENABLED); EnableMenuItem(g_sdata.menu,IDM_BROWSESCR,MF_ENABLED);
SetFocus(g_sdata.focused_hwnd);
} }
void CompileNSISScript() { void CompileNSISScript() {