[plt-scheme] Programing problems (without attachments)

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Thu Mar 5 07:47:08 EST 2009

At Wed, 4 Mar 2009 20:50:18 -0500, CHAMLY wrote:
> In order to move our canvas, we use:
> (define c 0)
> (define (move-niveau)
>    (if (= c 1)
>        (set! c 0)
>        (begin (send canvas init-auto-scrollbars  2000 #f  c 0)
>               (set! c (+ c 0.001))
>               (send canvas show-scrollbars #f #f)
>               (send canvas refresh))))
> But each time we call the Timer, our 'for' loop keeps, recreating the  
> lines of our level,
> (define TIMER (new timer% (notify-callback move-niveau)))
> How can we make the canvas advance with-out touching our 'for' Loop in  
> (niveau dc)?

I'm not sure that I understand your goal, but I think that instead of
trying to use scrollbars, you should instead try setting the "origin"
of the drawing context. That is, call

  (send dc set-origin (+ c) 0)

where your timer increments `c' each time. That way, anything you draw
in `niveau' will move to the right on each refresh.

Posted on the users mailing list.