How to make text scroll
Many times, especially on hardware with small screens, the controls are small and the text to be displayed is long.
At this point, we need to make the text scroll when the control gets focus/or click, so that the user can see the complete information.
AWTK provides the hscroll_label_t control, which can easily meet the needs of text scrolling.
1. Basic usage
Example:
<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>
2. Extended usage
But sometimes, instead of a simple text control, it is a control for list items, multi-select buttons, radio buttons, or other functions. What should I do?
In fact, it is also very simple, just use hscroll_label as the child control of the control, and specify the only_parent_focus property as true.
Example:
<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>
{{o.name}}
{{m.name}}