【发布时间】:2011-08-25 06:41:30
【问题描述】:
我正在尝试在我的自定义树中自定义 truncateToFit 选项。为了做到这一点,我必须将 LABEL 渲染到我的树中,因为树没有 TruncateToFit 属性。我是 flex 的初学者,我上网很多,看看他们是如何在树内渲染标签的,但我找不到任何解决方案。
我的预测对吗?如果是正确的,那么如何在树组件中呈现标签?
<ns1:PLTree verticalAlign="top" rendererIsEditor="true" columnWidth="150" height="100%" width="100%" x="0" y="0" borderThickness="0" dragEnabled="false" verticalScrollPolicy="auto" horizontalScrollPolicy="auto" dataProvider="{dBTree}" iconFunction="getTreeIcon" labelField="label" iconField="icon" showRoot="false" allowMultipleSelection="true" id="treTree" doubleClickEnabled="true" >
<ns1:itemRenderer>
<mx:Component>
<mx:Label truncateToFit="true" />
</mx:Component>
</ns1:itemRenderer>
</ns1:PLTree>
但如果我这样做,树的属性会被覆盖,所有内容都显示为文本。输出如下
请帮助我。提前非常感谢。
【问题讨论】:
-
我尝试在树渲染器中使用 truncateToFit,但它传递了一个错误.. 任何人都可以显示如何做到这一点的示例代码
-
为什么不使用不可编辑的文本区域而不是标签。文本区域将负责将文本换行到下一行。
标签: apache-flex actionscript-3 tree itemrenderer custom-component