Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
Apache Flex 4.14.1
-
None
-
None
Description
Hello,
Spark TextInput selectedRange not work correctly in desktop when anchorPosition = activePosition,
the text is fully selected.
Bar.XML
<?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"> <fx:Script> <![CDATA[ import mx.events.FlexEvent; [Bindable] private var pos:Number = 0; protected function textinput1_selectionChangeHandler(event:FlexEvent):void { pos = TextInput(event.target).selectionAnchorPosition; } protected function button1_clickHandler(pos:Number):void { ti.setFocus(); ti.selectRange(pos,pos); } ]]> </fx:Script> <s:layout> <s:VerticalLayout /> </s:layout> <s:TextInput id="ti" text="abces" selectionChange="textinput1_selectionChangeHandler(event)"/> <s:Label text="{'lastCursorPos ' + pos}"/> <s:Button label="Set pos 1" click="button1_clickHandler(1)" /> <s:Button label="Set pos 5" click="button1_clickHandler(5)" /> </s:Application>
you can test the problem at http://pol2095.free.fr/TextInput_selectRange/
I add a Spark RichEditableText, it work, it's a Spark TextInput bug.
The same code work correctly with flex 4.6.
Thanks.