You may also need to selectRange on focusIn.

On 3/13/14 11:09 AM, "mark goldin" <[email protected]> wrote:

>addEventListener("valueCommit", onValueChange, false, 0, true);
>private function onValueChange(event:Event):void
>{
>textInput.selectRange(0, textInput.text.length);
>}
>
>Like I said, does not work. No code is needed if switch to another Window
>and then switch back to Browser.
>
>
>On Thu, Mar 13, 2014 at 1:01 PM, mark goldin <[email protected]>
>wrote:
>
>> I tried selectRange. Did not help.I will also try valueCommit. But, how
>> come switching applications help to highlight?
>>
>>
>> On Thu, Mar 13, 2014 at 12:57 PM, Alex Harui <[email protected]> wrote:
>>
>>> selectRange should select all the text.  But there might be other code
>>> running after your code that resets the selected range so the real
>>>trick
>>> may be getting your code to run last.
>>>
>>> On 3/13/14 10:53 AM, "mark goldin" <[email protected]> wrote:
>>>
>>> >Right, but the thing is that the selected item is getting highlighted
>>> with
>>> >no additional code - just switch to another Windows program and then
>>> >switch
>>> >back to Browser with the Flex application. So, I am afraid no matter
>>>how
>>> >and where I add code it wont work until I place a focus on some other
>>> >control and then bring it back to my combo.
>>> >
>>> >
>>> >On Thu, Mar 13, 2014 at 12:49 PM, Alex Harui <[email protected]> wrote:
>>> >
>>> >> The ComboBox itself should dispatch a valueCommit event if the text
>>>is
>>> >> changed via drop-down selection.
>>> >>
>>> >> On 3/13/14 10:44 AM, "mark goldin" <[email protected]> wrote:
>>> >>
>>> >> >I see. But what I am after is to highlight a text when an item is
>>> >> >selected.
>>> >> >No matter what I do the selected item is not highlighted. However,
>>> >> >switching between any Windows application and Flex will highlight
>>>it.
>>> >>So,
>>> >> >it's about positioning a focus somewhere and then place it back to
>>>the
>>> >> >combo. Any thoughts?
>>> >> >
>>> >> >Thanks
>>> >> >
>>> >> >
>>> >> >On Thu, Mar 13, 2014 at 12:36 PM, Alex Harui <[email protected]>
>>> wrote:
>>> >> >
>>> >> >> If you choose from the drop down, the textInput is
>>>programmatically
>>> >> >> modified so no change notification event is dispatched.
>>> >> >>
>>> >> >> On 3/13/14 9:37 AM, "mark goldin" <[email protected]> wrote:
>>> >> >>
>>> >> >> >I have the following code to accomplish what is says in the
>>>title:
>>> >> >> >
>>> >> >> >override protected function childrenCreated():void
>>> >> >> >{
>>> >> >> >super.childrenCreated();
>>> >> >> >textInput.addEventListener("change", onValueChange, false, 0,
>>> true);
>>> >> >> >}
>>> >> >> >private function onValueChange(event:Event):void
>>> >> >> >{
>>> >> >> >textInput.selectRange(0, textInput.text.length);
>>> >> >> >}
>>> >> >> >
>>> >> >> >The listener is not called when I use a mouse to change a value.
>>> But
>>> >> >>if I
>>> >> >> >type in it does fire.
>>> >> >> >Not sure what would the difference be. Any idea?
>>> >> >> >
>>> >> >> >Thanks
>>> >> >>
>>> >> >>
>>> >>
>>> >>
>>>
>>>
>>

Reply via email to