Newbie stuck again...
[1/2] from: kpeters::mvinc::net at: 9-Oct-2003 21:52
Hi list ~
first of all thanks to everyone who helped last time. As you can see below, I have been
tinkering there with one of the three snippets offered and while the original snippey
worked, it does not work in my context - it starts printing messages after I quit...
Any ideas?
Thanks again,
Kai
REBOL []
do-scan?: no
; --------------------------------------------------------------------------------
do_services: does [
do-scan?: yes
print "performing services"
]
; --------------------------------------------------------------------------------
do_cancel: does [
do-scan?: no
print "services canceled"
]
; --------------------------------------------------------------------------------
main_window: layout [
toggle_start: toggle 60 "Start" "Stop" mint #"^s"
[
face/color: pick reduce [ sienna mint ] face/data
show face
do-scan?: pick reduce [ no yes ] face/data
]
]
; --------------------------------------------------------------------------------
main_window/feel: make main_window/feel [
detect: func[face event] [
if event/type = 'close [ do-scan?: no quit ]
event
]
]
; --------------------------------------------------------------------------------
unview/all
view center-face main_window
forever [
wait 5
either do-scan? [ do_services ] [ do_cancel ]
]
[2/2] from: didec:tiscali at: 10-Oct-2003 12:25
Re: Newbie stuck again...
Simple and usual error : you use "view" instead of "view/new".
As you can see by yourself with "source view" (read carrefully, there is a trap), "View"
use the "do-events" function that is the same as "wait []".
So it's "View" that do the wait. The program continue just when you close the window
and do your wait.
Use "View/new" to not doing the "do-events" and continue the execution.
So use :
; --------------------------------------------------------------------------------
unview/all
view/NEW center-face main_window
forever [
wait 5
either do-scan? [ do_services ] [ do_cancel ]
]
DideC