Inform broken? work-around
[1/2] from: felixs::ihug::com::au at: 14-Apr-2002 17:17
I wanted the original window to remain open, so I 'locked' the first window
with 'to-image. Here's the code for the list archive.
Felix
REBOL [
test-dlg: make object! [
go: does [ inform lay ]
lay: layout [ vh4 "hello" button "OK" [hide-popup] ]
]
lock-layout: func [ lay [object!] /local temp-lay temp-img buf-img][
temp-lay: layout [at 0x0 temp-img: image ]
buf-img: to-image lay
temp-img/image: buf-img
temp-lay/size: lay/size
temp-img/size: lay/size
temp-lay/offset: lay/offset
view temp-lay
]
main-lay: layout [
across
check radio radio field
return
button "show dialog" [ dlg: make test-dlg [] dlg/go ]
button "hide first" [
lock-layout main-lay
dlg: make test-dlg [] dlg/go
view main-lay
]
button "quit" [ unview ]
]
view main-lay
]
[2/2] from: anton:lexicon at: 14-Apr-2002 21:06
You could also append a transparent box to
the pane of the layout you want to lock.
Gabriele, I think, mentioned this technique
first.
append lay/pane make get-style 'box [
offset: 0x0
size: lay/size
effect: [luma -20] ; optionally darken the display
edge: none
]
show lay
Then later, to unlock:
remove back tail lay/pane
show lay
In both of these techniques, the window can still be closed
by pressing the close button, so you will need to catch
the event by modifying lay/feel, like this:
view/new lay ; must be done first (view changes feel)
lay/feel: make lay/feel [
detect: func [face event][
;probe event/type ; see what's going on
if all [event/type = 'close window-locked?][return none]
either all [
event/type = 'key
face: find-key-face face event/key
][
if get in face 'action [do-face face event/key]
none
][
event
]
]
]
wait none ; start waiting for events
Where you set window-locked? to true or false
at the appropriate moment.
Anton.