[plt-scheme] Class questions

From: Katsmall T. Wise, Esquire (kela_bit at netvision.net.il)
Date: Wed May 14 06:19:54 EDT 2003

Ed Cavazos wrote:

>(define extended-canvas%
>  (class canvas%
>    (define backing-store
>      (make-object bitmap%
>        (send this get-width)
>        (send this get-height)
>        #f))
>    (super-instantiate ())))
If I'm not mistaken, you must create the super instance before calling 
any of its procedures.

(define extended-canvas%
  (class canvas%
    (super-instantiate ())
    (inherit get-width)
    (inherit get-height)
    (define backing-store
      (make-object bitmap% (get-width) (get-height) #f))))

However, if you resize the canvas, the backing-store could get too small.
Thus, I suggest adding draw methods to the extended-canvas% like 
draw-line, draw-bitmap, set-pen, set-brush, and drawing them on a 
backing-store at on-paint. The backing-store here would be only to 
reduce, flickering (which will then only happen on refresh).

This, however, already exists, at 

Katsmall T. Wise, Esquire

Posted on the users mailing list.