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

时间:2013-07-26 15:44:25

标签: rebol rebol3 r3-gui

我正在尝试在查看后将字段添加到布局

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,它会打开一个新窗口。我只需要取消查看它然后再查看吗?

3 个答案:

答案 0 :(得分:5)

您也可以在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

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

答案 1 :(得分:1)

从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,它们将一个面和一个块作为参数,其中该块包含另一个面的定义。

答案 2 :(得分:0)

我还不知道观点,但我有一个提示。第一行将“m”设置为块[field“hello”]。检查“update-face”期望的内容......