Rebol / Red VID:为什么会立即发送近距离事件?

时间:2018-04-25 23:04:13

标签: rebol red

我受到http://www.codeconscious.com/rebol/view-notes.html

的启发

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

    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 ]
    ]

1 个答案:

答案 0 :(得分:3)

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 事件。

相关问题