- made NSIS ignore WM_COMMAND from disabled controls
- made NSISdl set the cancel button as the default button git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3330 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
8a85e1c0dd
commit
466e93ea11
5 changed files with 47 additions and 39 deletions
|
@ -644,7 +644,11 @@ LRESULT WINAPI WMCommandProc(HWND hWnd, UINT id, HWND hwndCtl, UINT codeNotify)
|
|||
if (pField->nFlags & FLAG_NOTIFY) {
|
||||
// Remember which control was activated then pretend the user clicked Next
|
||||
g_NotifyField = nIdx + 1;
|
||||
// the next button must be enabled or nsis will ignore WM_COMMAND
|
||||
BOOL bWasDisabled = EnableWindow(hNextButton, TRUE);
|
||||
FORWARD_WM_COMMAND(hMainWindow, IDOK, hNextButton, codeNotify, mySendMessage);
|
||||
if (bWasDisabled)
|
||||
EnableWindow(hNextButton, FALSE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -233,8 +233,6 @@ __declspec(dllexport) void download (HWND parent,
|
|||
if (IsWindowVisible(hwndB)) ShowWindow(hwndB,SW_HIDE);
|
||||
else hwndB=NULL;
|
||||
|
||||
wasen=EnableWindow(GetDlgItem(parent,IDCANCEL),1);
|
||||
|
||||
lpWndProcOld = (void *)SetWindowLong(parent,GWL_WNDPROC,(long)ParentWndProc);
|
||||
|
||||
dlg = CreateDialog((HINSTANCE)hModule,
|
||||
|
@ -307,6 +305,13 @@ __declspec(dllexport) void download (HWND parent,
|
|||
SendDlgItemMessage(dlg, pbid, WM_SETFONT, hFont, 0);
|
||||
SendDlgItemMessage(dlg, IDC_STATIC2, WM_SETFONT, hFont, 0);
|
||||
}
|
||||
|
||||
// enable the cancel button
|
||||
wasen=EnableWindow(GetDlgItem(parent,IDCANCEL),TRUE);
|
||||
SendMessage(parent, DM_SETDEFID, IDCANCEL, 0);
|
||||
// remove the BS_DEFPUSHBUTTON style from IDOK
|
||||
SendMessage(GetDlgItem(parent, IDOK), BM_SETSTYLE, BS_PUSHBUTTON, TRUE);
|
||||
SetFocus(GetDlgItem(parent,IDCANCEL));
|
||||
}
|
||||
{
|
||||
WSADATA wsaData;
|
||||
|
@ -385,7 +390,7 @@ __declspec(dllexport) void download (HWND parent,
|
|||
|
||||
SetWindowPos(childwnd,0,0,0,orig_childRc.right-orig_childRc.left,orig_childRc.bottom-orig_childRc.top,SWP_NOACTIVATE|SWP_NOZORDER|SWP_NOMOVE);
|
||||
|
||||
if (wasen) EnableWindow(GetDlgItem(parent,IDCANCEL),0);
|
||||
if (wasen) EnableWindow(GetDlgItem(parent,IDCANCEL),FALSE);
|
||||
}
|
||||
if ( !error )
|
||||
error = "cancel";
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -96,43 +96,39 @@ static BOOL NSISCALL SetDlgItemTextFromLang_(HWND dlg, int id, int lid) {
|
|||
|
||||
#ifdef NSIS_CONFIG_ENHANCEDUI_SUPPORT
|
||||
#define HandleStaticBkColor() _HandleStaticBkColor(uMsg, wParam, lParam)
|
||||
static BOOL NSISCALL _HandleStaticBkColor(UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
||||
switch (uMsg) {
|
||||
case WM_CTLCOLORSTATIC:
|
||||
case WM_CTLCOLOREDIT:
|
||||
case WM_CTLCOLORDLG:
|
||||
case WM_CTLCOLORBTN:
|
||||
{
|
||||
ctlcolors *c = (ctlcolors *)GetWindowLong((HWND)lParam, GWL_USERDATA);
|
||||
static BOOL NSISCALL _HandleStaticBkColor(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if ((uMsg - WM_CTLCOLOREDIT) <= (WM_CTLCOLORSTATIC - WM_CTLCOLOREDIT))
|
||||
{
|
||||
ctlcolors *c = (ctlcolors *)GetWindowLong((HWND)lParam, GWL_USERDATA);
|
||||
|
||||
if (c) {
|
||||
COLORREF text;
|
||||
LOGBRUSH lh;
|
||||
if (c) {
|
||||
COLORREF text;
|
||||
LOGBRUSH lh;
|
||||
|
||||
text = c->text;
|
||||
if (c->flags & CC_TEXT_SYS)
|
||||
text = GetSysColor(text);
|
||||
if (c->flags & CC_TEXT)
|
||||
SetTextColor((HDC)wParam, text);
|
||||
text = c->text;
|
||||
if (c->flags & CC_TEXT_SYS)
|
||||
text = GetSysColor(text);
|
||||
if (c->flags & CC_TEXT)
|
||||
SetTextColor((HDC)wParam, text);
|
||||
|
||||
SetBkMode((HDC)wParam, c->bkmode);
|
||||
SetBkMode((HDC)wParam, c->bkmode);
|
||||
|
||||
lh.lbColor = c->bkc;
|
||||
if (c->flags & CC_BK_SYS)
|
||||
lh.lbColor = GetSysColor(lh.lbColor);
|
||||
if (c->flags & CC_BK)
|
||||
SetBkColor((HDC)wParam, lh.lbColor);
|
||||
lh.lbColor = c->bkc;
|
||||
if (c->flags & CC_BK_SYS)
|
||||
lh.lbColor = GetSysColor(lh.lbColor);
|
||||
if (c->flags & CC_BK)
|
||||
SetBkColor((HDC)wParam, lh.lbColor);
|
||||
|
||||
if (c->flags & CC_BKB)
|
||||
{
|
||||
lh.lbStyle = c->lbStyle;
|
||||
if (c->bkb)
|
||||
DeleteObject(c->bkb);
|
||||
c->bkb = CreateBrushIndirect(&lh);
|
||||
}
|
||||
|
||||
return (BOOL)c->bkb;
|
||||
if (c->flags & CC_BKB)
|
||||
{
|
||||
lh.lbStyle = c->lbStyle;
|
||||
if (c->bkb)
|
||||
DeleteObject(c->bkb);
|
||||
c->bkb = CreateBrushIndirect(&lh);
|
||||
}
|
||||
|
||||
return (BOOL)c->bkb;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -553,7 +549,7 @@ skipPage:
|
|||
}
|
||||
if (uMsg == WM_CLOSE && m_page == g_blocks[NB_PAGES].num - 1)
|
||||
{
|
||||
if (!IsWindowEnabled(m_hwndCancel) && IsWindowEnabled(m_hwndOK))
|
||||
if (!IsWindowEnabled(m_hwndCancel))
|
||||
{
|
||||
uMsg = WM_COMMAND;
|
||||
wParam = IDOK;
|
||||
|
@ -561,7 +557,10 @@ skipPage:
|
|||
}
|
||||
if (uMsg == WM_COMMAND)
|
||||
{
|
||||
int id=LOWORD(wParam);
|
||||
int id = LOWORD(wParam);
|
||||
HWND hCtl = GetDlgItem(hwndDlg, id);
|
||||
if (hCtl && !IsWindowEnabled(hCtl))
|
||||
return 0;
|
||||
|
||||
if (id == IDOK)
|
||||
{
|
||||
|
@ -596,7 +595,7 @@ skipPage:
|
|||
{
|
||||
// Forward WM_COMMANDs to inner dialogs, can be custom ones.
|
||||
// Without this, enter on buttons in inner dialogs won't work.
|
||||
SendMessage(m_curwnd, uMsg, wParam, lParam);
|
||||
SendMessage(m_curwnd, WM_COMMAND, wParam, lParam);
|
||||
}
|
||||
}
|
||||
return HandleStaticBkColor();
|
||||
|
@ -700,8 +699,8 @@ static BOOL CALLBACK LicenseProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
|
|||
{
|
||||
if (msgfilter->msg==WM_KEYDOWN)
|
||||
{
|
||||
if (msgfilter->wParam==VK_RETURN && IsWindowEnabled(m_hwndOK)) {
|
||||
outernotify(1);
|
||||
if (msgfilter->wParam==VK_RETURN) {
|
||||
SendMessage(g_hwnd, WM_COMMAND, IDOK, 0);
|
||||
}
|
||||
if (msgfilter->wParam==VK_ESCAPE) {
|
||||
SendMessage(g_hwnd, WM_CLOSE, 0, 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue