我有这个代码:
REBOL [Title: "Employee list"]
screen1: does [
emp-list: [
"Amy" 1
"Bob" 2
"Carrie" 3
]
gui-layout: [ text "click your name" ]
foreach [emp-name emp-id] emp-list [
append gui-layout compose/deep [
box (emp-name) [screen2 (emp-id)]
]
]
view layout gui-layout
]
screen2: func [emp-id] [
choice-list: [
"A" 11
"B" 22
]
gui-layout: [
box "<-- back to names" [screen1]
text reform ["clicked id " emp-id ", now choose below"]
]
foreach [choice-name choice-id] choice-list [
append gui-layout compose/deep [
box (choice-name) [print [(emp-id) (choice-id)]]
]
]
view layout gui-layout
]
screen1
现在,如果您单击某人然后单击“返回”,菜单就会增长。(如果您单击其他人,第二个菜单也会增长。)我发现的一种解决方法(?)是在修复第一个屏幕clear emp-list
之前放置view layout gui-layout
这样做。然而,如果我print emp-list
在那里,我可以看到它并没有emp-list
在增长。怎么会这样?