如何在Spark Textarea中添加选项卡?

时间:2016-09-19 22:58:59

标签: flex flex4 tlf

我想在Spark TextArea中键入选项卡,我找到的唯一示例是mx TextArea。

以下是我在建议中使用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>

1 个答案:

答案 0 :(得分:1)

这应该可以得到想要的结果:

<?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>

这适用于Flex 4.6.0