[
https://issues.apache.org/jira/browse/FLEX-34953?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15030207#comment-15030207
]
pol poggi edited comment on FLEX-34953 at 11/27/15 8:12 PM:
------------------------------------------------------------
I find a workaround
{code:title=Bar.XML|borderStyle=solid}
<?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(textInput:TextInput, pos:Number):void
{
textInput.setFocus();
callLater(button1_clickHandlerCL, [textInput,
pos, 0]);
}
protected function
button1_clickHandlerCL(textInput:TextInput, pos:Number, i:int):void
{
i++;
if(i == 3) textInput.selectRange(pos, pos);
else callLater(button1_clickHandlerCL,
[textInput, pos, i]);
}
]]>
</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(ti, 1)" />
<s:Button label="Set pos 5" click="button1_clickHandler(ti, 5)" />
<s:Spacer height="50"/>
</s:Application>
{code}
was (Author: pol2095):
up
> Spark TextInput selectedRange not work correctly in desktop
> -----------------------------------------------------------
>
> Key: FLEX-34953
> URL: https://issues.apache.org/jira/browse/FLEX-34953
> Project: Apache Flex
> Issue Type: Bug
> Components: Spark: TextInput
> Affects Versions: Apache Flex 4.14.1
> Reporter: pol poggi
>
> Hello,
> Spark TextInput selectedRange not work correctly in desktop when
> anchorPosition = activePosition,
> the text is fully selected.
> {code:title=Bar.XML|borderStyle=solid}
> <?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>
> {code}
> 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.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)