You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2019/12/18 23:56:39 UTC

[royale-asjs] branch develop updated (4ba1c82 -> f9b9c7c)

This is an automated email from the ASF dual-hosted git repository.

aharui pushed a change to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git.


    from 4ba1c82  Merge branch 'fix_xml_delete' into develop
     new 1c9c62a  emulate keyCode
     new f9b9c7c  more support for selection.  Should fix #626 and #628

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../src/main/royale/mx/controls/TextInput.as       | 22 ++++++++++++++++++++++
 .../src/main/royale/mx/events/KeyboardEvent.as     |  2 +-
 2 files changed, 23 insertions(+), 1 deletion(-)


[royale-asjs] 01/02: emulate keyCode

Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git

commit 1c9c62a909f8a62197a9ccb44eb62e69f1490447
Author: Alex Harui <ah...@apache.org>
AuthorDate: Wed Dec 18 15:53:56 2019 -0800

    emulate keyCode
---
 frameworks/projects/MXRoyale/src/main/royale/mx/events/KeyboardEvent.as | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/events/KeyboardEvent.as b/frameworks/projects/MXRoyale/src/main/royale/mx/events/KeyboardEvent.as
index d520358..82d4003 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/events/KeyboardEvent.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/events/KeyboardEvent.as
@@ -103,7 +103,7 @@ public class KeyboardEvent extends org.apache.royale.events.KeyboardEvent
 		
 		public function get keyCode():uint
 		{
-		return 0;
+		    return nativeEvent["keyCode"];
 		}
 		
 		public function set keyCode(val:uint):void


[royale-asjs] 02/02: more support for selection. Should fix #626 and #628

Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git

commit f9b9c7cfeaae56da01c916e3d4545a32fdab623e
Author: Alex Harui <ah...@apache.org>
AuthorDate: Wed Dec 18 15:55:06 2019 -0800

    more support for selection.  Should fix #626 and #628
---
 .../src/main/royale/mx/controls/TextInput.as       | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/TextInput.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/TextInput.as
index dd9ffce..63dec3b 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/TextInput.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/TextInput.as
@@ -1196,6 +1196,10 @@ public class TextInput extends UIComponent implements ITextInput
      */
     public function get selectionBeginIndex():int
     {
+        COMPILE::JS
+        {
+            _selectionBeginIndex = (element as HTMLInputElement).selectionStart;        
+        }
         return _selectionBeginIndex;
     }
 
@@ -1205,6 +1209,10 @@ public class TextInput extends UIComponent implements ITextInput
     public function set selectionBeginIndex(value:int):void
     {
         _selectionBeginIndex = value;
+        COMPILE::JS
+        {
+            (element as HTMLInputElement).selectionStart = value;        
+        }
     }
 
     //----------------------------------
@@ -1241,6 +1249,10 @@ public class TextInput extends UIComponent implements ITextInput
      */
     public function get selectionEndIndex():int
     {
+        COMPILE::JS
+        {
+            _selectionEndIndex = (element as HTMLInputElement).selectionEnd;        
+        }
         return _selectionEndIndex;
     }
 
@@ -1253,6 +1265,10 @@ public class TextInput extends UIComponent implements ITextInput
         selectionChanged = true;
 
         invalidateProperties();
+        COMPILE::JS
+        {
+            (element as HTMLInputElement).selectionEnd = value;        
+        }
     }
 
     //----------------------------------
@@ -1308,7 +1324,13 @@ public class TextInput extends UIComponent implements ITextInput
 		
 		COMPILE::JS
 		{
+            // Flash does not reset selection when setting text
+            // but browser does
+            _selectionBeginIndex = (element as HTMLInputElement).selectionStart;
+            _selectionEndIndex = (element as HTMLInputElement).selectionEnd;
 			(element as HTMLInputElement).value = value;
+            (element as HTMLInputElement).selectionStart = _selectionBeginIndex;
+            (element as HTMLInputElement).selectionEnd = _selectionEndIndex;
 		}
 
         dispatchEvent(new Event('textChanged'));