diff dwt/widgets/Label.d @ 207:12feeed18183

Allow Label.setText with null argument.
author Frank Benoit <benoit@tionex.de>
date Sun, 09 Mar 2008 10:58:49 +0100
parents 17f8449522fd
children 380bad9f6852
line wrap: on
line diff
--- a/dwt/widgets/Label.d	Sat Mar 08 23:00:05 2008 +0100
+++ b/dwt/widgets/Label.d	Sun Mar 09 10:58:49 2008 +0100
@@ -21,7 +21,7 @@
 import dwt.widgets.Composite;
 import dwt.widgets.ImageList;
 
-import tango.stdc.stringz;
+import dwt.dwthelper.utils;
 
 /**
  * Instances of this class represent a non-selectable
@@ -567,11 +567,12 @@
  */
 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;
     text = string;
     char [] chars = fixMnemonic (string);
-    OS.gtk_label_set_text_with_mnemonic (cast(GtkLabel*)labelHandle, toStringz(chars));
+    OS.gtk_label_set_text_with_mnemonic (cast(GtkLabel*)labelHandle, chars.toStringzValidPtr());
     OS.gtk_widget_hide (imageHandle);
     OS.gtk_widget_show (labelHandle);
 }