Rebol / Red VID:为什么立即发送关闭事件?

Rebol / Red VID: why is close event immediately sent ?

我的灵感来自http://www.codeconscious.com/rebol/view-notes.html

我不明白:为什么关闭立即发送:这不是我想要的,我希望它在我单击 Window 关闭时发送

    query-on-close: func[face event][
        print "query-on-close"
        remove-event-func :query-on-close
        RETURN event    

    ]

    view layout [
        do [ insert-event-func :query-on-close ]
    ]
rebol []

query-on-close: func [face event][
    prin event/type prin " "
    either 'close = event/type [
        print "^/query-on-close handler now removed. Next close will now close this window"
        remove-event-func :f
        return none
    ][
        RETURN event    
    ]
]
f: insert-event-func :query-on-close

view layout [
    title "Test screen"
]

正如所写,您收到的第一个事件将打印消息,然后删除处理程序。您需要专门针对 CLOSE 事件进行测试。