Changeset 180:772f75da6a52

Show
Ignore:
Timestamp:
03/09/08 06:03:57 (6 months ago)
Author:
Frank Benoit <benoit@tionex.de>
branch:
default
Message:

Allow null argument for Label.setText

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • dwt/dwthelper/utils.d

    r177 r180  
    321321} 
    322322 
     323public char* toStringzValidPtr( char[] src ){ 
     324    if( src ){ 
     325        return src.toStringz(); 
     326    } 
     327    else{ 
     328        static const char[] nullPtr = "\0"; 
     329        return nullPtr.ptr; 
     330    } 
     331} 
     332 
    323333static char[] toHex(uint value, bool prefix = true, int radix = 8){ 
    324334    return tango.text.convert.Integer.toString( 
  • dwt/widgets/Label.d

    r117 r180  
    395395public void setText (char[] string) { 
    396396    checkWidget (); 
    397     if (string is null) error (DWT.ERROR_NULL_ARGUMENT); 
     397    // DWT extension: allow null for zero length string 
     398    //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); 
    398399    if ((style & DWT.SEPARATOR) !is 0) return; 
    399400    /* 
     
    403404    * nothing. 
    404405    */ 
    405     if (string==/*eq*/text) return; 
     406    if (string.equals(text)) return; 
    406407    text = string; 
    407408    if (image is null || !IMAGE_AND_TEXT) { 
     
    420421    } 
    421422    string = Display.withCrLf (string); 
    422     TCHAR* buffer = StrToTCHARz (/+getCodePage (),+/ string); 
     423    TCHAR* buffer = StrToTCHARz ( getCodePage (), string); 
    423424    OS.SetWindowText (handle, buffer); 
    424425    /*