diff --git a/reactos/dll/win32/comctl32/comctl32_ros.diff b/reactos/dll/win32/comctl32/comctl32_ros.diff index d14857c23c4..aa33052f974 100644 --- a/reactos/dll/win32/comctl32/comctl32_ros.diff +++ b/reactos/dll/win32/comctl32/comctl32_ros.diff @@ -13,4 +13,97 @@ Index: listview.c - (lvItem.state & LVIS_SELECTED) && (infoPtr->bFocus) ? ILD_SELECTED : ILD_NORMAL); } - /* Don't bother painting item being edited */ \ No newline at end of file + /* 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; diff --git a/reactos/dll/win32/comctl32/propsheet.c b/reactos/dll/win32/comctl32/propsheet.c index 04872202d27..13955aab93e 100644 --- a/reactos/dll/win32/comctl32/propsheet.c +++ b/reactos/dll/win32/comctl32/propsheet.c @@ -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;