在 Rebol 中创建布局

Creating a layout in Rebol

我正在尝试按照@GrahamChiu 在 上的回答中描述的方式创建视图显示的布局:

REBOL []

; WANT TO CREATE A BLOCK: [across chvar: check label "test"] , so that I can run: 
; view layout [across chvar: check label "test"]

toappend: [across (to-set-word "chvar") 'check 'label "test" ]
probe toappend

mylist: []
foreach i toappend [append mylist i]
probe mylist

view layout mylist

我稍后想创建一个循环来将许多这样的集合添加到布局中。

probe 输出为:

[across (to-set-word "chvar") 'check 'label "test"]
[across to-set-word "chvar" check label "test"]

但是,"chvar" 没有设置为 chvar:,我收到以下错误:

Invalid args: [to-set-word "chvar" check label "test"]

显然,(to-set-word "chvar") 在被追加之前没有得到评估。如何纠正?

您忘记了撰写

红色

toappend:  compose [across (to-set-word "chvar") check text "test" ]
mylist: []
foreach i toappend [append mylist i]
view layout mylist

因为 Red 不知道标签,否则与 Rebol 相同