Property sheet:

- Set focus to defpushbutton or to first WC_EDIT child window if present, like it works on windows.
- update wine diff
This fixes the regression in 2nd stage setup when no keyboard focus was present.

svn path=/trunk/; revision=25768
This commit is contained in:
Timo Kreuzer 2007-02-10 22:02:45 +00:00
parent 4cef94f636
commit 3a80060bfe
2 changed files with 143 additions and 13 deletions

View file

@ -13,4 +13,97 @@ Index: listview.c
- (lvItem.state & LVIS_SELECTED) && (infoPtr->bFocus) ? ILD_SELECTED : ILD_NORMAL);
}
/* Don't bother painting item being edited */
/* Don't bother painting item being edited */
Index: propsheet.c
===================================================================
--- propsheet.c (revision 25766)
+++ propsheet.c (working copy)
@@ -2422,6 +2422,28 @@
return FALSE;
}
+BOOL CALLBACK
+EnumChildProc(HWND hwnd, LPARAM lParam)
+{
+ WCHAR szType[20];
+ RealGetWindowClassW(hwnd, szType, 20);
+
+ if (strcmpW(szType, WC_EDITW) == 0)
+ {
+ if (IsWindowEnabled(hwnd) && IsWindowVisible(hwnd))
+ {
+ SetFocus(hwnd);
+ return FALSE;
+ }
+ }
+ else
+ {
+ EnumChildWindows(hwnd, EnumChildProc, 0);
+ }
+
+ return TRUE;
+}
+
/******************************************************************************
* PROPSHEET_SetWizButtons
*
@@ -2444,17 +2466,6 @@
EnableWindow(hwndNext, FALSE);
EnableWindow(hwndFinish, FALSE);
- /* set the default pushbutton to an enabled button */
- if (((dwFlags & PSWIZB_FINISH) || psInfo->hasFinish) && !(dwFlags & PSWIZB_DISABLEDFINISH))
- SendMessageW(hwndDlg, DM_SETDEFID, IDC_FINISH_BUTTON, 0);
- else if (dwFlags & PSWIZB_NEXT)
- SendMessageW(hwndDlg, DM_SETDEFID, IDC_NEXT_BUTTON, 0);
- else if (dwFlags & PSWIZB_BACK)
- SendMessageW(hwndDlg, DM_SETDEFID, IDC_BACK_BUTTON, 0);
- else
- SendMessageW(hwndDlg, DM_SETDEFID, IDCANCEL, 0);
-
-
if (dwFlags & PSWIZB_BACK)
EnableWindow(hwndBack, TRUE);
@@ -2484,6 +2495,32 @@
}
else if (!(dwFlags & PSWIZB_DISABLEDFINISH))
EnableWindow(hwndFinish, TRUE);
+
+ /* set the default pushbutton to an enabled button and give it focus */
+ if (((dwFlags & PSWIZB_FINISH) || psInfo->hasFinish) && !(dwFlags & PSWIZB_DISABLEDFINISH))
+ {
+ SendMessageW(hwndDlg, DM_SETDEFID, IDC_FINISH_BUTTON, 0);
+ SetFocus(hwndFinish);
+ }
+ else if (dwFlags & PSWIZB_NEXT)
+ {
+ SendMessageW(hwndDlg, DM_SETDEFID, IDC_NEXT_BUTTON, 0);
+ SetFocus(hwndNext);
+ }
+ else if (dwFlags & PSWIZB_BACK)
+ {
+ SendMessageW(hwndDlg, DM_SETDEFID, IDC_BACK_BUTTON, 0);
+ SetFocus(hwndBack);
+ }
+ else
+ {
+ SendMessageW(hwndDlg, DM_SETDEFID, IDCANCEL, 0);
+ SetFocus(GetDlgItem(hwndDlg, IDCANCEL));
+ }
+
+ /* Now try to find an edit control that deserves focus */
+ EnumChildWindows(PropSheet_GetCurrentPageHwnd(hwndDlg), EnumChildProc, 0);
+
}
/******************************************************************************
@@ -3548,7 +3585,7 @@
return FALSE;
}
-
+
case WM_SYSCOLORCHANGE:
COMCTL32_RefreshSysColors();
return FALSE;

View file

@ -2422,6 +2422,28 @@ static BOOL PROPSHEET_RemovePage(HWND hwndDlg,
return FALSE;
}
BOOL CALLBACK
EnumChildProc(HWND hwnd, LPARAM lParam)
{
WCHAR szType[20];
RealGetWindowClassW(hwnd, szType, 20);
if (strcmpW(szType, WC_EDITW) == 0)
{
if (IsWindowEnabled(hwnd) && IsWindowVisible(hwnd))
{
SetFocus(hwnd);
return FALSE;
}
}
else
{
EnumChildWindows(hwnd, EnumChildProc, 0);
}
return TRUE;
}
/******************************************************************************
* PROPSHEET_SetWizButtons
*
@ -2444,17 +2466,6 @@ static void PROPSHEET_SetWizButtons(HWND hwndDlg, DWORD dwFlags)
EnableWindow(hwndNext, FALSE);
EnableWindow(hwndFinish, FALSE);
/* set the default pushbutton to an enabled button */
if (((dwFlags & PSWIZB_FINISH) || psInfo->hasFinish) && !(dwFlags & PSWIZB_DISABLEDFINISH))
SendMessageW(hwndDlg, DM_SETDEFID, IDC_FINISH_BUTTON, 0);
else if (dwFlags & PSWIZB_NEXT)
SendMessageW(hwndDlg, DM_SETDEFID, IDC_NEXT_BUTTON, 0);
else if (dwFlags & PSWIZB_BACK)
SendMessageW(hwndDlg, DM_SETDEFID, IDC_BACK_BUTTON, 0);
else
SendMessageW(hwndDlg, DM_SETDEFID, IDCANCEL, 0);
if (dwFlags & PSWIZB_BACK)
EnableWindow(hwndBack, TRUE);
@ -2484,6 +2495,32 @@ static void PROPSHEET_SetWizButtons(HWND hwndDlg, DWORD dwFlags)
}
else if (!(dwFlags & PSWIZB_DISABLEDFINISH))
EnableWindow(hwndFinish, TRUE);
/* set the default pushbutton to an enabled button and give it focus */
if (((dwFlags & PSWIZB_FINISH) || psInfo->hasFinish) && !(dwFlags & PSWIZB_DISABLEDFINISH))
{
SendMessageW(hwndDlg, DM_SETDEFID, IDC_FINISH_BUTTON, 0);
SetFocus(hwndFinish);
}
else if (dwFlags & PSWIZB_NEXT)
{
SendMessageW(hwndDlg, DM_SETDEFID, IDC_NEXT_BUTTON, 0);
SetFocus(hwndNext);
}
else if (dwFlags & PSWIZB_BACK)
{
SendMessageW(hwndDlg, DM_SETDEFID, IDC_BACK_BUTTON, 0);
SetFocus(hwndBack);
}
else
{
SendMessageW(hwndDlg, DM_SETDEFID, IDCANCEL, 0);
SetFocus(GetDlgItem(hwndDlg, IDCANCEL));
}
/* Now try to find an edit control that deserves focus */
EnumChildWindows(PropSheet_GetCurrentPageHwnd(hwndDlg), EnumChildProc, 0);
}
/******************************************************************************
@ -3548,7 +3585,7 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return FALSE;
}
case WM_SYSCOLORCHANGE:
COMCTL32_RefreshSysColors();
return FALSE;