Thursday, July 12, 2012

Text - TextArea

TextArea是被用來放置多行文字的WTK元件,它通常會使用ScrollPane包裏起來,以提供捲軸。本範例來自官網



============範例展示=================================================


============範例展示=================================================

<!--ui.bxml-->
<Window title="Text Areas" maximized="true"
        xmlns:bxml="http://pivot.apache.org/bxml"
        xmlns="org.apache.pivot.wtk">
    <Border styles="{color:10}">
        <ScrollPane horizontalScrollBarPolicy="fill">
            <TablePane styles="{padding:8, verticalSpacing:8}">
                <columns>
                    <TablePane.Column width="1*"/>
                </columns>
 
                <TablePane.Row height="1*">
                    <Border styles="{color:10}">
                        <ScrollPane horizontalScrollBarPolicy="fill"
                                    verticalScrollBarPolicy="fill_to_capacity"
                                    preferredHeight="240">
                            <TextArea text="@sample1.txt"/>
                        </ScrollPane>
                    </Border>
                </TablePane.Row>
 
                <TablePane.Row height="-1">
                    <Border styles="{color:10}">
                        <TextArea minimumHeight="80" text="@sample2.txt"/>
                    </Border>
                </TablePane.Row>
            </TablePane>
        </ScrollPane>
    </Border>
</Window>

後記:
雖然在官網上寫著TextArea支援格式化的字串,但是在API中又寫明說不支援,經查詢後發現,新的元件TextPane應該才有支援格式化字串(但此功能難以使用並且仍在開發中)。

No comments:

Post a Comment