[ros-diffs] [tkreuzer] 25768: 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.

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Sat Feb 10 23:02:46 CET 2007


Author: tkreuzer
Date: Sun Feb 11 01:02:45 2007
New Revision: 25768

URL: http://svn.reactos.org/svn/reactos?rev=25768&view=rev
Log:
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.

Modified:
    trunk/reactos/dll/win32/comctl32/comctl32_ros.diff
    trunk/reactos/dll/win32/comctl32/propsheet.c

Modified: trunk/reactos/dll/win32/comctl32/comctl32_ros.diff
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/comctl32_ros.diff?rev=25768&r1=25767&r2=25768&view=diff
==============================================================================
--- trunk/reactos/dll/win32/comctl32/comctl32_ros.diff (original)
+++ trunk/reactos/dll/win32/comctl32/comctl32_ros.diff Sun Feb 11 01:02:45 2007
@@ -13,4 +13,97 @@
 -                         (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;

Modified: trunk/reactos/dll/win32/comctl32/propsheet.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/propsheet.c?rev=25768&r1=25767&r2=25768&view=diff
==============================================================================
--- trunk/reactos/dll/win32/comctl32/propsheet.c (original)
+++ trunk/reactos/dll/win32/comctl32/propsheet.c Sun Feb 11 01:02:45 2007
@@ -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;




More information about the Ros-diffs mailing list