Uploaded image for project: 'Apache Flex'
  1. Apache Flex
  2. FLEX-33537

Spark TextArea writing in prompt text format

    XMLWordPrintableJSON

Details

    Description

      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.

      Attachments

        1. enter.zip
          19 kB
          Roberto Ferreras

        Issue Links

          Activity

            People

              paeros Mark Kessler
              cjaube Curtis J. Aube
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: