How about this:

        do-scan?: yes
        view/new lay: layout [
                button "scan on" [do-scan?: yes]
                button "scan off" [do-scan?: no]
        ]
        ;;; <- (insert feel code, below)
        forever [wait [0:0:3] print now if do-scan? [print "do scan"]]

7-Oct-2003/12:12:13+10:00
do scan
7-Oct-2003/12:12:16+10:00
do scan
;;;; <--- here I pressed "scan off" button
7-Oct-2003/12:12:19+10:00
7-Oct-2003/12:12:22+10:00
7-Oct-2003/12:12:25+10:00
...

You would need to catch the close event of the window and
turn the scan off or break the forever loop anyway.

lay/feel: make lay/feel [
        detect: func [face event][
                if event/type = 'close [
                        do-scan?: no
                ]
                event ; return the event so it can be processed
        ]
]

Anton.

> I am trying to write an app that monitors a given set of
> directories on the
> local drive at 5 min. intervals and then transfers any file it may find in
> one of these dirs to a ftp server, so it needs to basically loop forever.
>
> I want to have a Start/Stop toggle to initate or cancel this operation.
>
> How do I test for a 'cancel event' in my forever loop. Does someone have a
> little sample snippet that demonstrates Rebol's abilities for
> this purpose?
>
> Again, thanks a lot in advance!
>
> Kai

-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.

Reply via email to