Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Window using forever loop

 [1/7] from: tmoeller:fastmail:fm at: 20-Nov-2006 17:17


Hi all, what might be the best way to have a window with a process running behind it, checking something and if a change occurs, the window ist updated??? I made a GUI and function for the check. Checking and updating the window via button is working fine. Now thought about implementing a process with the forever command and wanted to start it, when the window opens or at some time before. First, i cannot find an 'open event. What can i use instead? Second, is the forever loop the right way to make the process?? Third, is the event the right way to start the process automatically??? Can anybody help me out? Thorsten -- http://www.fastmail.fm - Access all of your messages and folders wherever you are

 [2/7] from: ammon::johnson::gmail::com at: 30-Nov-2006 14:18


You could create a face with a rate and have it checking for updates. On 11/20/06, Thorsten Moeller <tmoeller-fastmail.fm> wrote:

 [3/7] from: nick1::musiclessonz::com at: 30-Nov-2006 21:15


Hi Thorsten, Ammon's suggestion is described here, with some code examples: http://musiclessonz.com/rebol.html#section-6.3 Quoting Ammon Johnson <ammon.johnson-gmail.com>:

 [4/7] from: nick::guitarz::org at: 30-Nov-2006 21:01


Ammon's suggestion is described a bit more here: http://musiclessonz.com/rebol.html#section-6.3 Quoting Ammon Johnson <ammon.johnson-gmail.com>:

 [5/7] from: tmoeller::fastmail::fm at: 21-Nov-2006 13:43


Hi all, what might be the best way to have a window with a process running behind it, checking something and if a change occurs, the window ist updated??? I made a GUI and function for the check. Checking and updating the window via button is working fine. Now thought about implementing a process with the forever command and wanted to start it, when the window opens or at some time before. First, i cannot find an 'open event. What can i use instead? Second, is the forever loop the right way to make the process?? Third, is the event the right way to start the process automatically??? Can anybody help me out? Thorsten ------ Thorsten Moeller Schwalbenweg 5a 22453 Hamburg Fon: 040 / 589 17 980 Mobil: 0171 / 490 33 59 Mail: tmoeller-fastmail.fm -- http://www.fastmail.fm - Send your email first class

 [6/7] from: Izkata::Comcast::net at: 4-Dec-2006 9:19


view/new layout [...........] forever [ check-and-update wait 00:01:00 ] view/new displays the window, the returns immediately - it doesn't wait for the window to close. So it'll be open and running inside the 'forever loop. Include a 'wait in there so that the window still responds to events and your function isn't running continuously. On Tue, 2006-11-21 at 13:43 +0100, tmoeller-fastmail.fm wrote:

 [7/7] from: anton::wilddsl::net::au at: 5-Dec-2006 19:40


Hi Thorsten, If you can divide your process up into chunks with a short time interval, then you can use the technique below: Anton. window: layout [ pic: image (make image! 100x100) btn "abort" [abort?: true] ] max-n: pic/image/size/x * pic/image/size/y do-some-work: func [n][ print ["do some work" now/time/precise] loop 279 [ poke pic/image n random white n: n + 1 if n > max-n [break] ] show window n ] n: 1 ; work position abort?: none forever [ if n < max-n [ ; still work to do ? if not find system/view/screen-face/pane window [ ; window not shown already ? view/new window ; open the window without WAITing ] n: do-some-work n ] print "handle events" wait 0.2 ; <- this waits for window events and also for a 0.2 second timeout ; WAIT waits for window events by default because system/view/event-port is found ; by default in system/ports/wait-list if abort? [break] ]