Rebol 代码 gui 工作但不清除字段
Rebol code gui working but not clearing fields
我正在尝试以下代码,用户输入 2 个数字,然后单击计算按钮,应显示答案。还有用于清除字段和退出的按钮。
REBOL[]
fields: [f-ht f-wt ans]
reset-fields: does [
unfocus
f-ht/text: " " ; Changing this to "ENTER NUMBER HERE" does not help
f-wt/text: " "
focus f-ht
]
oncalc: does [
ans/text: (to integer! f-wt/text) / ((100 * to integer! f-ht/text) * (100 * to integer! f-ht/text))
show fields
]
lo: layout [
style tx label 200x24 center
style fld field 200x24 center
style btn button 200x24 center
tx "First Number:"
f-ht: fld
tx "Second Number:"
f-wt: fld
btn "Calculate" [oncalc]
ans: tx "Answer"
btn "Clear" [reset-fields show fields] ; NOT WORKING- NOTHING HAPPENS
btn "Exit" escape [unview/only lo]
]
reset-fields
view center-face lo
GUI 显示正常。但是,存在以下问题:
On clear button clicking, nothing is happening.
GUI 没有变化,也没有报告错误。问题出在哪里,如何解决?感谢您的帮助。
清除字段而不是设置为新字符串
reset-fields: does [
unfocus
clear f-ht/text
clear f-wt/text
focus f-ht
]
我正在尝试以下代码,用户输入 2 个数字,然后单击计算按钮,应显示答案。还有用于清除字段和退出的按钮。
REBOL[]
fields: [f-ht f-wt ans]
reset-fields: does [
unfocus
f-ht/text: " " ; Changing this to "ENTER NUMBER HERE" does not help
f-wt/text: " "
focus f-ht
]
oncalc: does [
ans/text: (to integer! f-wt/text) / ((100 * to integer! f-ht/text) * (100 * to integer! f-ht/text))
show fields
]
lo: layout [
style tx label 200x24 center
style fld field 200x24 center
style btn button 200x24 center
tx "First Number:"
f-ht: fld
tx "Second Number:"
f-wt: fld
btn "Calculate" [oncalc]
ans: tx "Answer"
btn "Clear" [reset-fields show fields] ; NOT WORKING- NOTHING HAPPENS
btn "Exit" escape [unview/only lo]
]
reset-fields
view center-face lo
GUI 显示正常。但是,存在以下问题:
On clear button clicking, nothing is happening.
GUI 没有变化,也没有报告错误。问题出在哪里,如何解决?感谢您的帮助。
清除字段而不是设置为新字符串
reset-fields: does [
unfocus
clear f-ht/text
clear f-wt/text
focus f-ht
]