[plt-scheme] Re: MrEd - Animated canvas

From: Richard Cleis (rcleis at mac.com)
Date: Sun Mar 25 12:16:56 EDT 2007

On Mar 25, 2007, at 6:11 AM, Laurent wrote:

>> Use the REPL (the command line) to see the difference:
>>
>> 1) Evaluate 'refresh' to see what it returns
>> 2) Evaluate (refresh canvas_2) to see something completely different
>> 3) Evaluate (lambda () (refresh canvas_2)) to see something like 1
>> 4) Try (notify-callback (lambda () (refresh canvas_2)))
>>
>> rac
>
> Thank you, i understand :)

You can use this technique to write a function that makes  
refreshers.  Even though this case is almost trivial, it makes sense  
to write one function with the details so that the rest of the  
program is more naturally readable.  Suppose you have a canvas for a  
score, a canvas for the arena, and a canvas for player-info...

(define  (make-refresher canvas)
   (lambda  ()
     (send canvas refresh)))

(define  refresh-score  (make-refresher score-canvas))
(define  refresh-arena  (make-refresher arena-canvas))
(define  refresh-player (make-refresher player-canvas))

rac


>
> Somebody knows why the bat flickers with a thread ?
>
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.