在不少時候,特別是在小屏幕的硬件上,控件比較小而要顯示的文本比較長。oop
此時,咱們須要在控件得到焦點時/或點擊時,讓文本滾動起來,以便讓用戶看到完整的信息。code
AWTK 提供了 hscroll_label_t 控件,能夠輕鬆知足文本滾動的需求。ip
示例:擴展
<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 便可。scroll
示例:im
<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 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 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 only_parent_focus="true" x="right" y="middle" w="-30" h="100%" text="3.AWTK 爲用戶提供一個功能強大、高效可靠、簡單易用、可輕鬆作出炫酷效果的 GUI 引擎。" /> </check_button> </column> </row> </window>