REBOL 3-如何更新已查看的布局



我试图在查看后将字段添加到布局中

view/no-wait m: [field "hello"]
insert tail m 'field
insert tail m "hello"
update-face m
** Script error: update-face does not allow block! for its face argument

我想更新整个布局,而不仅仅是字段或其中的某个部分view m,则打开一个新窗口。我必须先取消查看,然后再查看吗?

您也可以在R3-GUI中使用LAYOUT函数。参见以下示例:

view/no-wait m: layout [field "hello"]
;We need to get the BACKDROP container which is first sub-face in the WINDOW face
m: first faces? m
append-content m [
    field "world"
]
do-events

当然,还有其他方法可以动态处理布局内容。

试试Richard 的这个例子

REBOL [
    Title: "Layouts example #20"
    Author: "Richard Smolak"
    Version: "$Id: layouts-20.r3 852 2010-10-07 13:28:26Z cyphre $"
]
stylize [
    tbox: hpanel [
        about: "Simple rectangular box."
        facets: [
            init-hint: 200x200
            min-hint: 0x0
            max-hint: guie/max-pair
            break-after: 1
        ]
        options: [
            init-hint: [pair!]
        ]
        actors: [
            on-make: [
                append face/options [
                    content: [
                        button "hello" on-action [print "hello"]
                        button "world" on-action [print "hello"]
                    ]
                ]
                do-actor/style face 'on-make none 'hpanel
            ]
        ]
        draw: [
            pen red
            fill-pen blue
            box 0x0 (viewport-box/bottom-right - 1)
        ]
    ]
]

view [
    test: tbox
    button "clear"
        on-action [
            clear-content test
        ]   
    button "set"
        on-action [
            set-content test [
                button "test"
                field "the best"
            ]
        ]   
    button "insert"
        on-action [
            insert-content test bind/set probe reduce [to-set-word copy/part random "abcdefgh" 2 'button join "button #" 1 + length? test/gob] 'system
        ]
    button "append"
        on-action [
            append-content test reduce ['button join "button #" 1 + length? test/gob]
        ]   
    button "remove 2 faces at pos 3"
        on-action [
            remove-content/pos/part test 3 2
        ]
]

所以你要找的词是append-contentinsert-content,它们以一个面和一个块作为参数,其中块包含另一个面的定义。

我还不知道视图,但我有一个提示。第一行将"m"设置为块[字段"hello"]。查看"更新面"所期望的内容。。。

相关内容

  • 没有找到相关文章