[REBOL] Re: listen to events only for a specific window?
From: cyphre:volny:cz at: 14-Jul-2001 1:20
Hi Anton and all again,
here is the working test example (WATCH OUT LINE BREAKS!):
-----snip-----
REBOL [
title: "simple example of freezing/redirecting event flow in multiple
lauoyts/windows"
author: [cyphre--volny--cz]
]
insert-event-func func [f e][ ;this little function does all the magic,
using 'frozen flag you can freeze any window when this function is inserted
either e/face/options = 'frozen [
return none
][
return e
]
]
view win1: layout [
banner "Window 1"
box 100x24 with [; just simple clock for testing time evets ;-)
rate: 1
feel: make feel [
engage: func [f a e][
if e/type = 'time [
f/text: to-string now/time
show f
]
]
]
]
field "type anything here" ; just for testing key events
button 150x24 "Freeze win1 now!" [
win1/options: 'frozen ;you can set this flag to any of your windows but
you have to insert the global event-func above
view/new win2: layout/offset [
banner "Window 1 is frozen"
vtext "it doesnot receive any kind of event..."
button 150x24 "Unfreeze win1 now!" [
win1/options: none ;unfreezing the window
unview win2
]
] 300x20
]
]
-----snip----
Just one little detail: I didn't checked the 'close event so when you close
the second window using native window close buton you cannot unfreeze the
window1 again and have to kill the reboil process...but solution of this
simple and its up to you ;-)
regards
Cyphre