在很多時候治力,特別是在小屏幕的硬件上,控件比較小而要顯示的文本比較長勃黍。
此時宵统,我們需要在控件獲得焦點時/或點擊時,讓文本滾動起來覆获,以便讓用戶看到完整的信息马澈。
AWTK 提供了 hscroll_label_t 控件益兄,可以輕松滿足文本滾動的需求。
一箭券、基本用法
示例:
<window anim_hint="htranslate" text="hscroll_label" children_layout="default(c=1,h=30,xm=10,s=5)">
<hscroll_label text="炫酷的 GUI 引擎。" />
<hscroll_label text="炫酷的 GUI 引擎疑枯。" style="right"/>
<hscroll_label
lull="1000"
loop="true"
yoyo="true"
ellipses="true"
focusable="true"
text="(always ellipses loop yoyo) 為用戶提供一個功能強大辩块、高效可靠、簡單易用荆永、可輕松做出炫酷效果的 GUI 引擎废亭。" />
<hscroll_label
focusable="true"
only_focus="true"
text="(only_focus noloop) 為用戶提供一個功能強大、高效可靠具钥、簡單易用豆村、可輕松做出炫酷效果的 GUI 引擎。" />
<hscroll_label
loop="true"
ellipses="true"
focusable="true"
only_focus="true"
text="(only_focus ellipses loop) 為用戶提供一個功能強大骂删、高效可靠掌动、簡單易用、可輕松做出炫酷效果的 GUI 引擎宁玫。" />
<hscroll_label
style="green"
loop="true"
yoyo="true"
ellipses="true"
focusable="true"
only_focus="true"
text="(only_focus ellipses loop yoyo) 為用戶提供一個功能強大粗恢、高效可靠、簡單易用欧瘪、可輕松做出炫酷效果的 GUI 引擎眷射。" />
</window>
二、擴展用法
但有時用的不是單純的文本控件佛掖,而是列表項妖碉、多選按鈕、單選按鈕或其它功能的控件芥被,那該怎么辦呢欧宜?
其實也很簡單,把 hscroll_label 作為該控件的子控件拴魄,并指定 only_parent_focus 屬性為 true 即可鱼鸠。
示例:
<window anim_hint="htranslate" move_focus_prev_key="up" move_focus_next_key="down" text="Basic Controls">
<row x="0" y="180" w="-50" h="90" children_layout="default(r=1,c=2,m=2)">
<column children_layout="default(r=3,c=1,ym=2,s=10)" >
<check_button name="r1" focusable="true" >
<hscroll_label style="green" only_parent_focus="true" x="right" y="middle" w="-30" h="100%"
text="1.AWTK 為用戶提供一個功能強大、高效可靠羹铅、簡單易用蚀狰、可輕松做出炫酷效果的 GUI 引擎。" />
</check_button>
<check_button name="r2" focusable="true">
<hscroll_label style="green" only_parent_focus="true" x="right" y="middle" w="-30" h="100%"
text="2.AWTK 為用戶提供一個功能強大职员、高效可靠麻蹋、簡單易用、可輕松做出炫酷效果的 GUI 引擎焊切。" />
</check_button>
<check_button name="r3" value="true" focusable="true">
<hscroll_label style="green" only_parent_focus="true" x="right" y="middle" w="-30" h="100%"
text="3.AWTK 為用戶提供一個功能強大扮授、高效可靠芳室、簡單易用、可輕松做出炫酷效果的 GUI 引擎刹勃。" />
</check_button>
</column>
</row>
</window>