[plt-scheme] Class questions
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
http://www.cs.utah.edu/plt/develop/memory-canvas.plt.
Katsmall T. Wise, Esquire