diff dwt/widgets/Text.d @ 152:834420cb1486

Delete, arrow keys and backspace are now working in text fields
author Jacob Carlborg <doob@me.com>
date Thu, 11 Jun 2009 01:20:52 +0200
parents 86fc761a24ae
children 8433dabeb15e
line wrap: on
line diff
--- a/dwt/widgets/Text.d	Wed Jun 10 21:52:31 2009 +0200
+++ b/dwt/widgets/Text.d	Thu Jun 11 01:20:52 2009 +0200
@@ -1379,12 +1379,12 @@
             oldText = new_String ([character]);
     }
     wchar[] newText = verifyText (oldText, start, end, nsEvent);
-    if (newText is null) return false;
+    //if (newText is null) return false; // DWT extension, empty strings could be null
     if (charCount - (end - start) + newText.length () > textLimit) {
         return false;
     }
-    result = newText is oldText;
-    if (newText !is oldText || hiddenText !is null) {
+    result = newText == oldText; // DWT extension, Use "==" instead of "is" because newText can be null
+    if (newText != oldText || hiddenText !is null) {
         if ((style & DWT.SINGLE) !is 0) {
             insertEditText (newText);
         } else {
@@ -1499,7 +1499,7 @@
 
 void setEditText (wchar[] string) {
     wchar [] buffer;
-    if ((style & DWT.PASSWORD) && echoCharacter !is '\0') {
+    if (((style & DWT.PASSWORD) is 0) && echoCharacter !is '\0') {
         hiddenText = string;
         buffer = new wchar [Math.min(hiddenText.length (), textLimit)];
         for (int i = 0; i < buffer.length; i++) buffer [i] = echoCharacter;