我在 Rebol2 中有一个 VID 列表,我想将其中一列设置为某种菜单,我可以从中从一组选项中选择一个值。我使用的代码基于 list-widget-example.r。这组选择是动态的。
我尝试将“选择”和“旋转”与一组静态选择一起使用,但效果不佳。使用“选择”总是使用第一个值,而“旋转”会弹出一个黑色窗口。
最佳答案
这是 @AntonRolls code 的精简版本这明确地回答了问题。这是“一个相当基本的示例,展示了如何在视频列表中使用选择菜单。”
members: [ {Gandalf} {Bilbo} {Frodo} ]
db: [
["1" "question 1 " "default1"]
["2" "question 2" ""]
["3" "question 3" "default3"]
]
view out: layout [
mylist: list 450x240 [
across
t1: text 50x20
t2: text 200x20 para [wrap?: true]
t3: text 200x20 effect [merge luma 10] font [] [
][
; alt-action (right-click action)
use [row][
if row: face/user-data [ ; face knows index
choose/window/offset members func [face value][
poke db/:row 3 face/text
] out (
mylist/offset + (t3/offset * 1x0)
+ (row - 1 * t3/size * 0x1)
)
]
]
]
] supply [
either count <= length? db [
face/user-data: count ; store row index
switch index [
1 [face/text: db/:count/1]
2 [face/text: db/:count/2]
3 [face/text: db/:count/3]
]
][
face/user-data: face/text: none
]
]
关于rebol - 如何将菜单放入 rebol 列表 (VID) 中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29171806/