天天看點

AWTK最新動态:新增TreeView,附使用方法

使用方法

AWTK最新動态:新增TreeView,附使用方法
AWTK最新動态:新增TreeView,附使用方法

tree_view 樹形視圖

樹形視圖由滾動視圖、垂直滾動條和水準滾動條三部分組成。

XML 描述如下:

<tree_view x="0" y="0" w="48%" h="48%" item_height="25" spacing="5" auto_hide_scroll_bar="true">
    <scroll_view name="view" x="0" y="0" w="-12" h="-12">
...
    scroll_view>
    <scroll_bar_d name="hbar" x="0" y="b" w="-12" h="12" value="0"/>
    <scroll_bar_d name="vbar" x="right" y="0" w="12" h="-12" value="0"/>
  tree_view>      

scroll_view 滾動視圖

滾動視圖可以包含多個 tree_item。

XML 描述如下:

<scroll_view name="view" x="0" y="0" w="-12" h="-12">
      <tree_item value="true">
...
      tree_item>

      <tree_item>
...
      tree_item>
    scroll_view>      

tree_item 樹形項

樹形項包含一個 tree_item_title 和一個 tree_item_content。tree_item_title 用來顯示自身的資訊,而 tree_item_content 用來包含子項目。

XML 描述如下:

<tree_item_title text="hello" style="folder"/>
<tree_item_content>
    <tree_item_title text="1.world" style="file"/>
    <tree_item_title text="2.world" style="file"/>
    <tree_item_title text="3.world" style="file"/>
    <slider value="40" w="200" />
tree_item_content>      

tree_item_title

可以顯示文本和圖示。也可以包含其它控件(如按鈕、文本、圖檔、進度條和多選按鈕等)

tree_item_content

可以包含:
  • tree_item 用于顯示下一級項目。
  • tree_item_title 用于顯示簡單的葉子節點。
  • button/progress_bar/check_button/radio_button/label 和 image 等基本控件用于顯示葉子節點。
<tree_item value="true">
    <tree_item_title text="hello" style="folder"/>
    <tree_item_content>
    <slider value="40" w="200" />
    <check_button text="2.world" w="200" />
    <radio_button text="2.world" w="200" />
    tree_item_content>
tree_item>