rebol - 如何将菜单放入 rebol 列表 (VID) 中?

标签 rebol rebol2

我在 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/

相关文章:

user-interface - 红色语言可执行文件也打开控制台

dll - 从 rebol 调用时从 dll 函数返回的指针

rebol - 如何从键盘上读取红色/rebol 的键

rebol - 如何设置按钮操作的样式

rebol - 在 REBOL 中动态地将单词添加到上下文中

rebol - 从 HTTP 读取文件

rebol - 如何访问 REBOL header ?

REBOL 程序简单的 GUI 窗口,开始

binary - 如何转换二进制!到一个字符!在《叛逆2》中?

android - Android 上的 Rebol GUI 显示屏太小