[plt-scheme] Flicker problem in win XP, fine on Linux

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Wed Jun 26 15:08:57 EDT 2002

First of all, I like to congratulate you all for getting the 200 release out
of the door.
It looks very nice, and I look forward to use it to teach Scheme after the
summer holiday.

Since I "have to" write all the text material my self, I have for some time
making all sorts of programs in DrScheme in order to find student projects
the varying sizes. Some of these will pop up on scheme.dk over summer.

The program causing problems is a little bitmap drawing program.

I have followed the Model-Controller-View model.
The model contains the bitmap. The view also contains a bitmap.
After the controller draws a point or line on the model bitmap,
the model bitmap is copied to the viewbitmap.
(Now the view is free to draw help-lines during draw operations
on its own bitmap).

When the screen needs updating, the viewbitmap is copied to the canvas:

(define mycanvas%
  (class canvas%
    (inherit get-dc)
    (define/override (on-subwindow-event receiver event)
      (dispatch-mouse-event  event))
    (super-instantiate ())))

(define canvas   (instantiate mycanvas% ()
                        (parent horizontal-panel)
                        (min-width width) (min-height height)
                        (paint-callback redraw)))

(define (redraw canvas device-context)
  (send device-context draw-bitmap viewbitmap 0 0))

On Windows XP I experience that when redraw is called, the canvas
is cleared before the viewbitmap is copied to the screen. When in
point (punkt) mode the canvas is redrawn repeatedly and thus causes

On Linux the canvas is not cleared, before the copy takes place
and everything looks beautiful in pointmode [*].

Can I do something to get rid of the flicker?

I have attached the source file (hop that's ok). So you can
see how for yourself, how it looks.
(The source is in Danish)

[*] In Linux you can see I forgot to clear the bitmap :-)

Jens Axel Søgaard

-------------- next part --------------
A non-text attachment was scrubbed...
Name: tegneprogram2.scm
Type: application/octet-stream
Size: 5079 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20020626/c12392d9/attachment.obj>

Posted on the users mailing list.