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

forever loops inside view

 [1/5] from: caw::cs::mu::oz::au at: 24-May-2001 7:21


I want a forever loop to start once a ui is viewed. How can I start the loop from "outside" the view. l: layout [ button "Go" [go] ] go: func [] [ forever [ print now/time wait 1 ] ] view l and then push the "Go" button works, but I want the loop to start automatically, without the user needing to do anything. btw, am I right in suggesting that face variables scope to the top level: l: layout [ t: text "Fred" ] t/text: "Bill" seems to work...what are the scoping rules for face variables? cheers and thanks! chris wright

 [2/5] from: cyphre:volny:cz at: 24-May-2001 10:29


Hello Chris, I know two methods how solve your problem 1) using 'feel parameter of face view l: layout [vtext "hello word" with [ rate: 1 feel: make feel [ engage: func [face action event][ if event/type = 'time [ print now/time ] ] ] ] ] 2) creating "interupt" while event-port is running (This is more interesting ;-) but has its advantages/disadvantages-beware of lenght interupts ((: ) view/new layout [button "hello word"] dispatch [1 [print now/time]] Have fun, Cyphre

 [3/5] from: gchiu:compkarori at: 24-May-2001 22:12


On Thu, 24 May 2001 07:21:41 +1000 "Chris Wright" <[caw--cs--mu--oz--au]> wrote:
> l: layout [ > button "Go" [go]
<<quoted lines omitted: 6>>
> ] > view l
Try: view/new l go -- Graham Chiu

 [4/5] from: gjones05:mail:orion at: 24-May-2001 5:37


From: "Chris Wright"
<snip> > btw, am I right in suggesting that face variables scope to the top
level:
> l: layout [ > t: text "Fred" > ] > > t/text: "Bill" > > seems to work...what are the scoping rules for face variables? <snip>
Hi, Chris, Cyphre (aka Richard Smolak) handled the first question. You are correct in regard to the scope of the face variables ("words" in the REBOL lexicon). In your example above, adding "show t" following the setting of t/text to "Bill" will update the face. To limit the scope, one must embed the layout within an object *and* then set the face name within that context. For example: my-lo: make object! [lo: layout [t1: text "goodbye"]] view/new my-lo/lo t1/text: "hello" show t1 allows t1 to be accessible from the global scope, as was true in your example. However, setting t1 to none within the object then makes that word local to that context. Consider: my-lo: make object! [t1: none lo: layout [t1: text "hello"]] view/new my-lo/lo t1/text: "hello" ;does not affect face show t1 ;does not affect face This example now does not affect the face. To reset the face text from the global context, now one must use the path notation, such as: ... my-lo/t1/text: "Goodbye" show my-lo/t1 For larger programs, this method helps one to keep the namespaces separate. This discussion may have covered more than you were really asking, but you would eventually be asking the additional questions, so ... Hope this helps. --Scott Jones

 [5/5] from: arolls:bigpond:au at: 24-May-2001 21:46


Hello, I recommend capturing time events too, and doing a bit more of your job each time. This is a good approach, it means the user can still click on the close button and get a timely response. If that's all you want to do, I think setting rate to 0 will go at maximum speed. Anton.

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted