LINK, dirreq, filereq and browse button in dirpage can be opened using ENTER KEY (WM_COMMAND events forward to inner dialogs), fixed problem with focus on Close/Finish button which was generating wierd beeps if user attempted to finish the installer with ENTER key.
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2707 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
9396324581
commit
8bf75b3634
5 changed files with 88 additions and 76 deletions
|
@ -175,6 +175,13 @@ int nRectId = 0;
|
|||
int nNumFields = 0;
|
||||
int g_done;
|
||||
|
||||
int FindControlIdx(UINT id)
|
||||
{
|
||||
for (int nIdx = 0; nIdx < nNumFields; nIdx++)
|
||||
if (id == pFields[nIdx].nControlID)
|
||||
return nIdx;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// array of HWNDs and window styles used to make the main NSIS controls invisible while this program runs.
|
||||
|
||||
|
@ -675,8 +682,7 @@ LRESULT WMCommandProc(HWND hWnd, UINT id, HWND hwndCtl, UINT codeNotify) {
|
|||
switch (codeNotify) {
|
||||
case BN_CLICKED:
|
||||
{
|
||||
for (int nIdx = 0; nIdx < nNumFields; nIdx++) {
|
||||
if (id == pFields[nIdx].nControlID) {
|
||||
int nIdx = FindControlIdx(id);
|
||||
if (pFields[nIdx].nType == FIELD_BROWSEBUTTON) {
|
||||
int nParentIdx = pFields[nIdx].nParentIdx;
|
||||
switch(pFields[nParentIdx].nType) {
|
||||
|
@ -691,8 +697,6 @@ LRESULT WMCommandProc(HWND hWnd, UINT id, HWND hwndCtl, UINT codeNotify) {
|
|||
} else if (pFields[nIdx].nType == FIELD_LINK) {
|
||||
ShellExecute(hMainWindow, NULL, pFields[nIdx].pszState, NULL, NULL, SW_SHOWDEFAULT);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -737,10 +741,7 @@ BOOL CALLBACK cfgDlgProc(HWND hwndDlg,
|
|||
case WM_DRAWITEM:
|
||||
{
|
||||
DRAWITEMSTRUCT* lpdis = (DRAWITEMSTRUCT*)lParam;
|
||||
for (int nIdx = 0; nIdx < nNumFields; nIdx++)
|
||||
{
|
||||
if (pFields[nIdx].nControlID == lpdis->CtlID )
|
||||
{
|
||||
int nIdx = FindControlIdx(lpdis->CtlID);
|
||||
#ifdef IO_LINK_UNDERLINED
|
||||
HFONT OldFont;
|
||||
LOGFONT lf;
|
||||
|
@ -762,7 +763,7 @@ BOOL CALLBACK cfgDlgProc(HWND hwndDlg,
|
|||
else
|
||||
SetTextColor(lpdis->hDC, RGB(0,0,255)); // Win95/NT4 arrggg!!!
|
||||
|
||||
GetClientRect(lpdis->hwndItem, &pFields[nIdx].rect);
|
||||
pFields[nIdx].rect = lpdis->rcItem;
|
||||
// Calculate needed size of the control
|
||||
DrawText(lpdis->hDC, pFields[nIdx].pszText, -1, &pFields[nIdx].rect, DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_CALCRECT);
|
||||
pFields[nIdx].rect.right += 4;
|
||||
|
@ -782,8 +783,6 @@ BOOL CALLBACK cfgDlgProc(HWND hwndDlg,
|
|||
#ifdef IO_LINK_UNDERLINED
|
||||
DeleteObject(SelectObject(lpdis->hDC, OldFont));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WM_CTLCOLORSTATIC:
|
||||
|
@ -807,14 +806,21 @@ BOOL CALLBACK cfgDlgProc(HWND hwndDlg,
|
|||
// pFields[nIdx].nParentIdx is used to store original windowproc
|
||||
int WINAPI StaticLINKWindowProc(HWND hWin, UINT uMsg, LPARAM wParam, WPARAM lParam)
|
||||
{
|
||||
for (int StaticField = 0; StaticField < nNumFields; StaticField++)
|
||||
{
|
||||
if (pFields[StaticField].nType == FIELD_LINK && hWin == pFields[StaticField].hwnd )
|
||||
{
|
||||
int StaticField = FindControlIdx(GetDlgCtrlID(hWin));
|
||||
switch(uMsg)
|
||||
{
|
||||
case WM_ERASEBKGND:
|
||||
return 0;
|
||||
case WM_GETDLGCODE:
|
||||
return DLGC_BUTTON|DLGC_WANTALLKEYS;
|
||||
case WM_KEYDOWN:
|
||||
{
|
||||
if ( wParam == VK_RETURN )
|
||||
WMCommandProc(hMainWindow, pFields[StaticField].nControlID, pFields[StaticField].hwnd, BN_CLICKED);
|
||||
else if ( wParam == VK_TAB )
|
||||
SendMessage(hMainWindow, WM_NEXTDLGCTL, GetKeyState(VK_SHIFT) & 0x8000, FALSE);
|
||||
}
|
||||
break;
|
||||
case WM_SETCURSOR:
|
||||
{
|
||||
if ( (HWND)wParam == hWin && LOWORD(lParam) == HTCLIENT )
|
||||
|
@ -830,9 +836,6 @@ int WINAPI StaticLINKWindowProc(HWND hWin, UINT uMsg, LPARAM wParam, WPARAM lPar
|
|||
}
|
||||
return CallWindowProc((WNDPROC)pFields[StaticField].nParentIdx, hWin, uMsg, wParam, lParam);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
int nIdx;
|
||||
|
@ -1190,7 +1193,8 @@ void showCfgDlg()
|
|||
{
|
||||
lpWndProcOld = (void *) SetWindowLong(hMainWindow,DWL_DLGPROC,(long)ParentWndProc);
|
||||
|
||||
SendMessage(hMainWindow, WM_NOTIFY_CUSTOM_READY, 0, 0);
|
||||
// Tell NSIS to remove old inner dialog and pass handle of the new inner dialog
|
||||
SendMessage(hMainWindow, WM_NOTIFY_CUSTOM_READY, (WPARAM)hConfigWindow, 0);
|
||||
ShowWindow(hConfigWindow, SW_SHOWNA);
|
||||
SetFocus(hNextButton);
|
||||
|
||||
|
|
|
@ -253,7 +253,8 @@ BOOL CALLBACK dlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
AddFolderFromReg(HKEY_LOCAL_MACHINE);
|
||||
AddFolderFromReg(HKEY_CURRENT_USER);
|
||||
|
||||
SendMessage(hwParent, WM_NOTIFY_CUSTOM_READY, 0, 0);
|
||||
// Tell NSIS to remove old inner dialog and pass handle of the new inner dialog
|
||||
SendMessage(hwParent, WM_NOTIFY_CUSTOM_READY, (WPARAM)hwndDlg, 0);
|
||||
ShowWindow(hwndDlg, SW_SHOWNA);
|
||||
SetFocus(GetDlgItem(hwParent, IDOK));
|
||||
}
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -453,6 +453,7 @@ nextPage:
|
|||
else {
|
||||
if (g_flags.abort) SetFocus(m_hwndCancel);
|
||||
else if (g_flags.autoclose) goto nextPage;
|
||||
else SetFocus(m_hwndOK); // without focus button, the system Beeps every time user press one key
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -499,6 +500,7 @@ nextPage:
|
|||
|
||||
if (uMsg == WM_NOTIFY_CUSTOM_READY) {
|
||||
DestroyWindow(m_curwnd);
|
||||
m_curwnd = (HWND)wParam;
|
||||
}
|
||||
if (uMsg == WM_CLOSE)
|
||||
{
|
||||
|
@ -541,6 +543,11 @@ nextPage:
|
|||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Forward WM_COMMANDs to inner dialogs, can be custom ones
|
||||
SendMessage(m_curwnd, uMsg, wParam, lParam);
|
||||
}
|
||||
}
|
||||
return HandleStaticBkColor();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue