如何允许在 Spark Textarea 中使用选项卡?
How do I allow tabs in a Spark Textarea?
我想在 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>
这应该会让您得到想要的结果:
<?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
我想在 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>
这应该会让您得到想要的结果:
<?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