<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
</head>
<body>
I have the following macros <tt>define-public-draw-procs</tt>, <tt>define-draw-proc</tt>
and class <tt>drawing-canvas% </tt>defined:<br>
<br>
(define-macro define-draw-proc<br>
(lambda (name)<br>
`(define (,name . args)<br>
(set! the-log (cons (cons ',name args)<br>
the-log))<br>
(on-paint))))<br>
<br>
(define-macro define-public-draw-procs<br>
(lambda names<br>
(append `(begin)<br>
(map (lambda (name)<br>
`(define-draw-proc ,name))<br>
names)<br>
(map (lambda (name)<br>
`(public ,name))<br>
names)<br>
`((void)))))<br>
<br>
(define drawing-canvas%<br>
(class canvas%<br>
(inherit get-dc)<br>
(inherit get-width)<br>
(inherit get-height)<br>
(define first-time? #t)<br>
(define bmp '---)<br>
(define bmp-dc '---)<br>
(define (do-first-time)<br>
(set! bmp (make-object bitmap% (get-width) (get-height) #f))<br>
(set! bmp-dc (instantiate bitmap-dc% ()))<br>
(send bmp-dc set-bitmap bmp)<br>
(set! first-time? #f))<br>
(define the-log empty)<br>
(define-public-draw-procs draw-arc<br>
draw-bitmap<br>
draw-bitmap-section<br>
draw-ellipse<br>
draw-line<br>
draw-lines<br>
draw-point<br>
draw-polygon<br>
draw-rectangle<br>
draw-rounded-rectangle<br>
draw-spline<br>
draw-text<br>
set-pen<br>
set-brush)<br>
(define (get-log)<br>
the-log)<br>
(define (set-log! v)<br>
(set! the-log v)<br>
(on-paint))<br>
(define (clear-log!)<br>
(set! the-log empty)<br>
(on-paint))<br>
(public get-log set-log! clear-log!)<br>
(define/override (on-paint)<br>
(if first-time? (do-first-time))<br>
(send bmp-dc clear)<br>
(set! the-log (draw-on-dc bmp-dc the-log))<br>
(send (get-dc) draw-bitmap bmp 0 0)<br>
(void))<br>
(super-instantiate ())))<br>
<br>
This works just fine with <br>
(define/override (on-paint)<br>
(send (get-dc) clear)<br>
(set! the-log (draw-on-dc (get-dc) the-log))<br>
(void))<br>
But here, it shows an empty canvas%...<br>
Now, what can be the problem?<br>
Is my draw-bitmap syntax wrong?<br>
Robby suggested a solution, but it's quite complicated, I'm trying to
find a simple solution that doesn't use modules, semaphores and the
likes (because I have <b>no</b> idea how to use them). He said he
wasn't sure about the organization of my code, so I put the class
declaration here... That's about it.<br>
<br>
Katsmall the Wise<br>
<a class="moz-txt-link-abbreviated" href="mailto:kela_bit@netvision.net.il">kela_bit@netvision.net.il</a><br>
</body>
</html>