diff dwt/widgets/Label.d @ 180:772f75da6a52

Allow null argument for Label.setText
author Frank Benoit <benoit@tionex.de>
date Sun, 09 Mar 2008 11:03:57 +0100
parents 25f88bf5a6df
children 026ce3b05f57
line wrap: on
line diff
--- a/dwt/widgets/Label.d	Sat Mar 08 14:00:55 2008 +0100
+++ b/dwt/widgets/Label.d	Sun Mar 09 11:03:57 2008 +0100
@@ -394,7 +394,8 @@
  */
 public void setText (char[] string) {
     checkWidget ();
-    if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
+    // DWT extension: allow null for zero length string
+    //if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
     if ((style & DWT.SEPARATOR) !is 0) return;
     /*
     * Feature in Windows.  For some reason, SetWindowText() for
@@ -402,7 +403,7 @@
     * has not changed.  The fix is to check for this case and do
     * nothing.
     */
-    if (string==/*eq*/text) return;
+    if (string.equals(text)) return;
     text = string;
     if (image is null || !IMAGE_AND_TEXT) {
         int oldBits = OS.GetWindowLong (handle, OS.GWL_STYLE), newBits = oldBits;
@@ -419,7 +420,7 @@
         if (oldBits !is newBits) OS.SetWindowLong (handle, OS.GWL_STYLE, newBits);
     }
     string = Display.withCrLf (string);
-    TCHAR* buffer = StrToTCHARz (/+getCodePage (),+/ string);
+    TCHAR* buffer = StrToTCHARz ( getCodePage (), string);
     OS.SetWindowText (handle, buffer);
     /*
     * Bug in Windows.  For some reason, the HBRUSH that