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/06 06:13:22 UTC

[royale-asjs] branch develop updated: support selection in TextInput

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


The following commit(s) were added to refs/heads/develop by this push:
     new e4de7ee  support selection in TextInput
e4de7ee is described below

commit e4de7eed714ad1d645956cefdd2412565af5a13f
Author: Alex Harui <ah...@apache.org>
AuthorDate: Thu Dec 5 22:13:07 2019 -0800

    support selection in TextInput
---
 .../MXRoyale/src/main/royale/mx/controls/TextInput.as        | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

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 dfd4b33..1c94bc3 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/TextInput.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/TextInput.as
@@ -35,16 +35,17 @@ import mx.events.KeyboardEvent;
 import mx.events.TextEvent;
 
 import org.apache.royale.core.ITextModel;
+import org.apache.royale.core.TextLineMetrics;
 import org.apache.royale.events.Event;
-import org.apache.royale.html.accessories.RestrictTextInputBead;
 import org.apache.royale.html.accessories.PasswordInputBead;
+import org.apache.royale.html.accessories.RestrictTextInputBead;
 import org.apache.royale.html.beads.DisableBead;
-import org.apache.royale.core.TextLineMetrics;
 
 COMPILE::SWF {
 	import org.apache.royale.html.beads.TextInputView;
 }
 import mx.core.mx_internal;
+
 use namespace mx_internal;
 
 /*
@@ -1717,6 +1718,7 @@ public class TextInput extends UIComponent implements ITextInput
      *  @playerversion Flash 9
      *  @playerversion AIR 1.1
      *  @productversion Flex 3
+     *  @royaleignorecoercion HTMLInputElement
      */
     public function setSelection(beginIndex:int, endIndex:int):void
     {
@@ -1725,6 +1727,12 @@ public class TextInput extends UIComponent implements ITextInput
         selectionChanged = true;
 
         invalidateProperties();
+        
+        COMPILE::JS
+        {
+            (element as HTMLInputElement).setSelectionRange(beginIndex, endIndex);        
+        }
+          
     }
 
     /**