2021-01-09 12:28:04 +08:00
|
|
|
<window text="Desktop" anim_hint="htranslate" single_instance="true">
|
2021-01-09 23:19:05 +08:00
|
|
|
<property name="on:window_open">
|
|
|
|
print("window_open")
|
|
|
|
</property>
|
|
|
|
<property name="on:window_will_open">
|
|
|
|
print("window_will_open")
|
|
|
|
</property>
|
|
|
|
<property name="on:window_close">
|
|
|
|
print("window_close")
|
|
|
|
</property>
|
|
|
|
|
|
|
|
<property name="on:key_down">
|
|
|
|
print("keydown:", key, "alt=", alt, "ctrl=", ctrl, "cmd=", cmd, "menu=", menu);
|
|
|
|
</property>
|
|
|
|
<property name="on:key_up">
|
|
|
|
print("keyup:", key, "alt=", alt, "ctrl=", ctrl, "cmd=", cmd, "menu=", menu);
|
|
|
|
</property>
|
|
|
|
<property name="on:key_long_press">
|
|
|
|
print("keyup:", key, "alt=", alt, "ctrl=", ctrl, "cmd=", cmd, "menu=", menu);
|
|
|
|
</property>
|
|
|
|
|
|
|
|
<property name="on:pointer_down">
|
|
|
|
print("pointerdown:", x, y, "alt=", alt, "ctrl=", ctrl, "cmd=", cmd, "menu=", menu);
|
|
|
|
</property>
|
|
|
|
<property name="on:pointer_up">
|
|
|
|
print("pointerup:", x, y, "alt=", alt, "ctrl=", ctrl, "cmd=", cmd, "menu=", menu);
|
|
|
|
</property>
|
|
|
|
<property name="on:click">
|
|
|
|
print("click:", x, y, "alt=", alt, "ctrl=", ctrl, "cmd=", cmd, "menu=", menu);
|
|
|
|
</property>
|
|
|
|
|
2022-07-07 10:47:52 +08:00
|
|
|
<view name="view" x="0" y="0" w="100%" h="100%" children_layout="default(c=1,r=13,m=5,s=5)">
|
2021-01-09 11:42:46 +08:00
|
|
|
<label name="label" text="label" />
|
2021-09-07 11:09:38 +08:00
|
|
|
<edit name="edit" tips="text edit" on:focus="print(focus)" on:blur="print('blur', widget_get('self','value'))"/>
|
|
|
|
<progress_bar name="bar" text="" value="10" on:value_changed="print(widget_get('self','value'))"/>
|
2021-01-09 23:19:05 +08:00
|
|
|
<view name="view" x="0" y="0" w="100%" h="100%" children_layout="default(c=2,r=1,m=2,s=2)">
|
2021-09-07 11:09:38 +08:00
|
|
|
<button focusable="true" focused="true" on:click="open('basic_fscript')" text="Basic" />
|
2021-01-09 11:42:46 +08:00
|
|
|
<button focusable="true" text="Buttons">
|
|
|
|
<property name="on:click">
|
2021-09-07 11:09:38 +08:00
|
|
|
win = open('button_fscript')
|
2021-01-09 11:42:46 +08:00
|
|
|
assert(!value_is_null(win))
|
2021-09-07 11:09:38 +08:00
|
|
|
widget_set(win, 'close.text', "Back")
|
|
|
|
assert(widget_get(win, 'close.text') == "Back");
|
2021-01-09 11:42:46 +08:00
|
|
|
</property>
|
|
|
|
</button>
|
2021-01-09 23:19:05 +08:00
|
|
|
</view>
|
2021-01-09 11:42:46 +08:00
|
|
|
|
|
|
|
<button focusable="true" text="Test">
|
|
|
|
<property name="on:click">
|
2021-09-07 11:09:38 +08:00
|
|
|
widget_set('parent', 'label.text', 'Hello');
|
|
|
|
assert(widget_get('parent', 'label.text') == 'Hello');
|
2021-01-09 11:42:46 +08:00
|
|
|
|
2021-09-07 11:09:38 +08:00
|
|
|
widget_set('window', 'view.label.text', 'Hello World');
|
|
|
|
assert(widget_get('window', 'view.label.text') == 'Hello World');
|
2021-01-09 11:42:46 +08:00
|
|
|
|
2021-09-07 11:09:38 +08:00
|
|
|
widget_set('self', 'text', 'Test...');
|
|
|
|
assert(widget_get('self', 'text') == 'Test...');
|
2021-01-09 11:42:46 +08:00
|
|
|
</property>
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<view name="view" x="0" y="0" w="100%" h="100%" children_layout="default(c=2,r=1,m=2,s=2)">
|
|
|
|
<button focusable="true" text="Inc">
|
|
|
|
<property name="on:click">
|
|
|
|
<![CDATA[
|
2021-09-07 11:09:38 +08:00
|
|
|
a = widget_lookup('window', 'bar', true)
|
2021-09-22 16:52:29 +08:00
|
|
|
if(a.value <= 90) {
|
|
|
|
a.value = a.value + 10
|
2021-01-09 11:42:46 +08:00
|
|
|
}
|
|
|
|
]]>
|
|
|
|
</property>
|
|
|
|
</button>
|
|
|
|
<button focusable="true" text="Dec">
|
|
|
|
<property name="on:click">
|
|
|
|
<![CDATA[
|
2021-09-07 11:09:38 +08:00
|
|
|
a = widget_lookup('window', 'bar', true)
|
2021-09-22 16:52:29 +08:00
|
|
|
if(a.value >= 10) {
|
|
|
|
a.value = a.value - 10
|
2021-01-09 11:42:46 +08:00
|
|
|
}
|
|
|
|
]]>
|
|
|
|
</property>
|
|
|
|
</button>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<view name="view" x="0" y="0" w="100%" h="100%" children_layout="default(c=2,r=1,m=2,s=2)">
|
|
|
|
<button focusable="true" text="Create">
|
|
|
|
<property name="on:click">
|
2021-09-07 11:09:38 +08:00
|
|
|
a = widget_lookup('window', 'foobar', true)
|
2021-01-09 11:42:46 +08:00
|
|
|
if(value_is_null(a)) {
|
2021-09-07 11:09:38 +08:00
|
|
|
a = widget_create('label', 'window.view', 0, 0, 0, 0)
|
2021-01-09 11:42:46 +08:00
|
|
|
assert(!value_is_null(a))
|
|
|
|
|
2021-09-07 11:09:38 +08:00
|
|
|
widget_set(a, 'text', 'Dynamic created')
|
|
|
|
assert(widget_get(a, 'text') == 'Dynamic created')
|
|
|
|
widget_set(a, 'name', 'foobar')
|
|
|
|
assert(widget_get(a, 'name') == 'foobar')
|
2021-01-09 11:42:46 +08:00
|
|
|
} else {
|
|
|
|
print("foobar exist");
|
|
|
|
}
|
|
|
|
</property>
|
|
|
|
</button>
|
|
|
|
<button focusable="true" text="Destroy">
|
|
|
|
<property name="on:click">
|
2021-09-07 11:09:38 +08:00
|
|
|
a = widget_lookup('window', 'foobar', true)
|
2021-01-09 11:42:46 +08:00
|
|
|
if(!value_is_null(a)) {
|
|
|
|
widget_destroy(a)
|
|
|
|
} else {
|
2021-09-07 11:09:38 +08:00
|
|
|
print('not found foobar');
|
2021-01-09 11:42:46 +08:00
|
|
|
}
|
|
|
|
</property>
|
|
|
|
</button>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<view name="view" x="0" y="0" w="100%" h="100%" children_layout="default(c=2,r=1,m=2,s=2)">
|
|
|
|
<button focusable="true" on:click="close()" text="Close" />
|
|
|
|
<button focusable="true" on:click="quit()" text="Quit" />
|
|
|
|
</view>
|
2021-12-23 17:01:48 +08:00
|
|
|
<view name="view_timer" x="0" y="0" w="100%" h="100%" children_layout="default(c=2,r=1,m=2,s=2)">
|
2021-01-09 17:03:06 +08:00
|
|
|
<button name="timer" focusable="true" on:click="start_timer(100)" text="Start Timer">
|
|
|
|
<property name="on:timer">
|
|
|
|
<![CDATA[
|
2021-09-07 11:09:38 +08:00
|
|
|
a = widget_lookup('window', 'bar', true)
|
|
|
|
b = widget_get(a, 'value')
|
2021-01-09 17:03:06 +08:00
|
|
|
if(b < 100) {
|
2021-09-07 11:09:38 +08:00
|
|
|
widget_set(a, 'value', b + 1)
|
2021-01-09 17:03:06 +08:00
|
|
|
} else {
|
2021-09-07 11:09:38 +08:00
|
|
|
widget_set(a, 'value', 0)
|
2021-01-09 17:03:06 +08:00
|
|
|
stop_timer()
|
|
|
|
}
|
|
|
|
]]>
|
|
|
|
</property>
|
|
|
|
</button>
|
2021-09-07 11:09:38 +08:00
|
|
|
<button focusable="true" on:click="stop_timer('parent.timer')" text="Stop Timer" />
|
2021-01-09 17:03:06 +08:00
|
|
|
</view>
|
2021-12-23 17:01:48 +08:00
|
|
|
<view name="view" x="0" y="0" w="100%" h="100%" children_layout="default(c=2,r=1,m=2,s=2)">
|
|
|
|
<button focusable="true" on:click="reset_timer('window.view.view_timer.timer')" text="Reset Timer" />
|
|
|
|
<button focusable="true" on:click="modify_timer('window.view.view_timer.timer', 1000)" text="Modify Timer" />
|
|
|
|
</view>
|
|
|
|
<view name="view" x="0" y="0" w="100%" h="100%" children_layout="default(c=2,r=1,m=2,s=2)">
|
|
|
|
<button focusable="true" on:click="suspend_timer('window.view.view_timer.timer')" text="Suspend Timer" />
|
|
|
|
<button focusable="true" on:click="resume_timer('window.view.view_timer.timer')" text="Resume Timer" />
|
|
|
|
</view>
|
2021-01-09 11:42:46 +08:00
|
|
|
<view name="view" x="0" y="0" w="100%" h="100%" children_layout="default(c=2,r=1,m=2,s=2)">
|
|
|
|
<button focusable="true" on:click="back()" text="Back" />
|
|
|
|
<button focusable="true" on:click="back_to_home()" text="Back To Home" />
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</window>
|