Tamás Nepusz created FLEX-34173:
-----------------------------------
Summary: Cannot move insertion point programmatically in a
single-line Spark TextInput using selectRange() when setFocus() is also called
Key: FLEX-34173
URL: https://issues.apache.org/jira/browse/FLEX-34173
Project: Apache Flex
Issue Type: Bug
Components: Spark: TextInput
Affects Versions: Apache Flex 4.12.0
Environment: Seen on Mac OS X 10.9; other platforms are probably also
affected
Reporter: Tamás Nepusz
Priority: Minor
Calling setFocus() on an unfocused TextInput, followed immediately by
selectRange(desiredInsertionPointIndex, desiredInsertionPointIndex) will select
the entire text in the RichEditableText.focusInHandler() instead of selecting
nothing and moving the insertion point to the desired index.
This is due to the fact that RichEditableText.selectRange() sets the internal
hasProgrammaticSelectionRange flag to true iff the anchor and active positions
of the selection are different. I wonder why we cannot simply set
hasProgrammaticSelectionRange to true even if the two positions are equal.
Workaround: setting multiline=true forces the focusInHandler to take a
different route and avoid the selectAll() call inside the focusInHandler that
alters the selection.
--
This message was sent by Atlassian JIRA
(v6.2#6252)