Hi
I am wondering how I would keep the focus/selection on a TextArea even when a button outside is clicked.
Like how the RichTextEditor does it.
Hi
I am wondering how I would keep the focus/selection on a TextArea even when a button outside is clicked.
Like how the RichTextEditor does it.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
<mx:TextArea id="textArea" focusOut="{textArea.setFocus()}" />
<mx:Button id="test" label="Test" />
</mx:Application>
In the event handler for the click event you will want to stopImmediatePropagation() and preventDefault() and then do your business with the selection/focus.
It appears that the RichTextEditor
is accomplishing its maintaining focus with the following line in setTextStyles()
:
callLater(textArea.setFocus)
I think any user interaction with the RTE
's controls will lead through this method, so that returns focus after the control event has completed.