[plt-scheme] Using a canvas% and its dc<%>

From: Akiva Kleiman (kela_bit at netvision.net.il)
Date: Sun Mar 2 09:04:04 EST 2003

Hello,

I was trying to draw a red circle on a window. Simple task, it seemed.
So I wrote this little batch of code.
     (define w (instantiate frame% ()
                 [label "Test frame"]))
     (define c (instantiate canvas% ()
                 [parent w]
                 [min-width 500]
                 [min-height 500]))
     (define d (send c get-dc))
     (define p (send the-pen-list find-or-create-pen
                     "red" 2 'solid))
     
     (send w show #t)
     (send d set-pen p)
     (send d draw-ellipse 100 100 200 200)

Little window, with a canvas in it, and it draws a red circle, filled with 
white; less then a second later, though, the entire window is filled with 
white, and my circle is nowhere to be found.
What could be the problem?


Katsmall the Wise
kela_bit at netvision.net.il



Posted on the users mailing list.