only display the troubleshoot button if necessary
authorThomas Bluemel <thomas@reactsoft.com>
Fri, 25 Nov 2005 22:01:19 +0000 (22:01 +0000)
committerThomas Bluemel <thomas@reactsoft.com>
Fri, 25 Nov 2005 22:01:19 +0000 (22:01 +0000)
svn path=/trunk/; revision=19574

reactos/lib/devmgr/En.rc
reactos/lib/devmgr/Pl.rc
reactos/lib/devmgr/hwpage.c

index 0705595..5458df4 100644 (file)
@@ -23,6 +23,7 @@ BEGIN
     LTEXT           "",IDC_MANUFACTURER,14,88,183,10,SS_ENDELLIPSIS
     LTEXT           "",IDC_LOCATION,14,100,183,10,SS_ENDELLIPSIS
     LTEXT           "",IDC_STATUS,14,112,183,30
     LTEXT           "",IDC_MANUFACTURER,14,88,183,10,SS_ENDELLIPSIS
     LTEXT           "",IDC_LOCATION,14,100,183,10,SS_ENDELLIPSIS
     LTEXT           "",IDC_STATUS,14,112,183,30
-    PUSHBUTTON      "&Troubleshoot...",IDC_TROUBLESHOOT,85,140,54,14
+    PUSHBUTTON      "&Troubleshoot...",IDC_TROUBLESHOOT,85,140,54,14,
+                    BS_PUSHBUTTON | WS_CHILD | WS_DISABLED | WS_TABSTOP
     PUSHBUTTON      "P&roperties",IDC_PROPERTIES,146,140,50,14
 END
     PUSHBUTTON      "P&roperties",IDC_PROPERTIES,146,140,50,14
 END
index e921e3b..4e9f7b9 100644 (file)
@@ -23,6 +23,7 @@ BEGIN
     LTEXT           "",IDC_MANUFACTURER,14,88,183,10,SS_ENDELLIPSIS
     LTEXT           "",IDC_LOCATION,14,100,183,10,SS_ENDELLIPSIS
     LTEXT           "",IDC_STATUS,14,112,183,30
     LTEXT           "",IDC_MANUFACTURER,14,88,183,10,SS_ENDELLIPSIS
     LTEXT           "",IDC_LOCATION,14,100,183,10,SS_ENDELLIPSIS
     LTEXT           "",IDC_STATUS,14,112,183,30
-    PUSHBUTTON      "&Rozwi¹zywanie problemów...",IDC_TROUBLESHOOT,85,140,54,14
+    PUSHBUTTON      "&Rozwi¹zywanie problemów...",IDC_TROUBLESHOOT,85,140,54,14,
+                    BS_PUSHBUTTON | WS_CHILD | WS_DISABLED | WS_TABSTOP
     PUSHBUTTON      "&W³a\9cciwo\9cci",IDC_PROPERTIES,146,140,50,14
 END
     PUSHBUTTON      "&W³a\9cciwo\9cci",IDC_PROPERTIES,146,140,50,14
 END
index ce8969e..5329d9b 100644 (file)
@@ -502,6 +502,20 @@ HardwareDlgResize(IN PHARDWARE_PAGE_DATA hpd,
 }
 
 
 }
 
 
+static VOID
+EnableTroubleShoot(PHARDWARE_PAGE_DATA hpd,
+                   BOOL Enable)
+{
+    HWND hBtnTroubleShoot = GetDlgItem(hpd->hWnd,
+                                       IDC_TROUBLESHOOT);
+
+    EnableWindow(hBtnTroubleShoot,
+                 Enable);
+    ShowWindow(hBtnTroubleShoot,
+               Enable ? SW_SHOW : SW_HIDE);
+}
+
+
 static INT_PTR
 CALLBACK
 HardwareDlgProc(IN HWND hwndDlg,
 static INT_PTR
 CALLBACK
 HardwareDlgProc(IN HWND hwndDlg,
@@ -548,6 +562,14 @@ HardwareDlgProc(IN HWND hwndDlg,
                                   (INT)HIWORD(lParam));
                 break;            
 
                                   (INT)HIWORD(lParam));
                 break;            
 
+            case WM_SETTEXT:
+            {
+                LPCWSTR szWndText = (LPCWSTR)lParam;
+                EnableTroubleShoot(hpd,
+                                   (szWndText != NULL && szWndText[0] != L'\0'));
+                break;
+            }
+
             case WM_INITDIALOG:
             {
                 hpd = (PHARDWARE_PAGE_DATA)lParam;
             case WM_INITDIALOG:
             {
                 hpd = (PHARDWARE_PAGE_DATA)lParam;
@@ -618,6 +640,10 @@ HardwareDlgProc(IN HWND hwndDlg,
 
                     /* fill the devices list view control */
                     FillDevicesList(hpd);
 
                     /* fill the devices list view control */
                     FillDevicesList(hpd);
+
+                    /* decide whether to show or hide the troubleshoot button */
+                    EnableTroubleShoot(hpd,
+                                       GetWindowTextLength(hwndDlg) != 0);
                 }
                 break;
             }
                 }
                 break;
             }