1.21 gigawatts
1.21 gigawatts

Reputation: 17736

How do I allow tabs in a Spark Textarea?

I would like to type in tabs in a Spark TextArea and the only examples I found are for mx TextArea.

Here is test data I'm using from the suggestion to use manageTabKey:

var config:Configuration = new Configuration();
var parser:ITextImporter;

config.manageTabKey = true;
parser = TextConverter.getImporter(TextConverter.PLAIN_TEXT_FORMAT, config);

textarea.textFlow = parser.importToFlow("test data");

MXML:

<s:TextArea id="textarea" width="100%" height="100%">

</s:TextArea>

Upvotes: 1

Views: 62

Answers (1)

Robin van den Bogaard
Robin van den Bogaard

Reputation: 520

This should get you the wanted result:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx" 
               minWidth="955" minHeight="600"
               creationComplete="creationCompleteHandler(event)">
    <fx:Script>
        <![CDATA[
            import mx.events.FlexEvent;

            import flashx.textLayout.elements.Configuration;

            protected function creationCompleteHandler(event:FlexEvent):void {
                (sparkTextArea.textFlow.configuration as Configuration).manageTabKey = true;
            }

        ]]>
    </fx:Script>
    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <s:TextArea id="sparkTextArea" />
</s:Application>

This works in Flex 4.6.0

Upvotes: 1

Related Questions