changeset 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 0ba75290f8ce
children 8433dabeb15e
files dwt/internal/cocoa/OS.d dwt/widgets/Display.d dwt/widgets/Text.d
diffstat 3 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/internal/cocoa/OS.d	Wed Jun 10 21:52:31 2009 +0200
+++ b/dwt/internal/cocoa/OS.d	Thu Jun 11 01:20:52 2009 +0200
@@ -79,7 +79,7 @@
     /*static this (){
         Library.loadLibrary("swt-pi"); //$NON-NLS-1$
     }*/
-    
+
     public static const int VERSION;
     static this () {
         int [1] response;
--- a/dwt/widgets/Display.d	Wed Jun 10 21:52:31 2009 +0200
+++ b/dwt/widgets/Display.d	Thu Jun 11 01:20:52 2009 +0200
@@ -3973,7 +3973,7 @@
         } else if (sel is OS.sel_insertText_) {
             widget.insertText (id, sel, arg0);
         } else if (sel is OS.sel_doCommandBySelector_) {
-            widget.doCommandBySelector (id, sel, cast(char*) arg0);
+            widget.doCommandBySelector (id, sel, cast(objc.SEL) arg0);
         } else if (sel is OS.sel_highlightSelectionInClipRect_) {
             widget.highlightSelectionInClipRect (id, sel, arg0);
         } else if (sel is OS.sel_reflectScrolledClipView_) {
--- 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;