flex-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Harui (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLEX-33537) Spark TextArea writing in prompt text format
Date Tue, 09 Dec 2014 17:01:13 GMT

    [ https://issues.apache.org/jira/browse/FLEX-33537?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14239652#comment-14239652

Alex Harui commented on FLEX-33537:

The fix in commit d5c329722cd60568c53210973024b591b912b486 has had a lot of side-effects.
 There is no protocol in the framework for knowing that a component has deferred assignment
of stage.focus.  Any other code depending on stage.focus pointing to the currently focused
item is at risk because it can't know that stage.focus is about to be assigned "later".

Normally, I would tell the bug author that Flex uses a validation/invalidation mechanism and
calling validateNow() before assigning focus would probably do the trick.  That needs to be
verified for this scenario.

I suppose we could add code to UIComponent or some other base class to call validateNow()
on itself before assigning focus, but that sets a precedence of adding validateNow() calls
to other places where you can get fooled by the validation mechanism and potentially affect

> Spark TextArea writing in prompt text format
> --------------------------------------------
>                 Key: FLEX-33537
>                 URL: https://issues.apache.org/jira/browse/FLEX-33537
>             Project: Apache Flex
>          Issue Type: Bug
>          Components: Spark: TextArea, Spark: TextInput
>    Affects Versions: Apache Flex 4.9.0
>            Reporter: Curtis Aube
>            Assignee: Mark Kessler
>             Fix For: Apache Flex Next
>         Attachments: enter.zip
> Initialize a s:TextArea, set the prompt text to something and set the text to something.
Sometime later set the text to empty string, remove the TextArea from the display, add it
to back the display and set focus on it. The next time you type, you will be typing in the
prompt text format.
> Ex.
> <?xml version="1.0" encoding="utf-8"?>
> <s:Application minHeight="600" minWidth="955" xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:s="library://ns.adobe.com/flex/spark">
> 	<fx:Script>
> 		<![CDATA[
> 			private function selectTextArea():void
> 			{
> 				testTextArea.text = "";
> 				box.removeAllElements();
> 				box.addElement(testTextArea);
> 				testTextArea.setFocus();
> 			}
> 		]]>
> 	</fx:Script>
> 	<s:VGroup>
> 		<s:HGroup>
> 			<s:Button label="Break text area" click="{selectTextArea()}"/>
> 		</s:HGroup>
> 		<s:HGroup id="box">
> 			<s:TextArea id="testTextArea" text="Some text" prompt="Enter something..."/>
> 		</s:HGroup>
> 	</s:VGroup>
> </s:Application>
> Another issue is: If you try to set the focus before removing and adding the TextArea,
the focus rectangle doesn't show up.
> Workaround: Don't set the focus immediately after adding the TextArea such as using callLater.

This message was sent by Atlassian JIRA

View raw message