Hello,<div><br></div><div>I have been working on a racket GUI recently. So far it&#39;s been wonderfully smooth sailing, especially compared to Java. I had a couple of questions about the canvas object. Any help would be wonderful.</div>
<div><br></div><div>Many Thanks,</div><div>Hillary</div><div><br></div><div>Questions:</div><div>1) </div><div>Why does this work?<br>(define canvas (new canvas% [parent window] [paint-callback (lambda (canvas dc) (draw canvas dc))]))</div>
<div><br></div><div>But this doesn&#39;t</div><div><div>(define canvas (new canvas% [parent window] [paint-callback  (draw canvas dc)]))</div></div><div><br></div><div>It seems that in both cases the paint-callback is being set to a 2-arity procedure. However, in the second case the window doesn&#39;t update unless draw is called from REPL.</div>
<div><br></div><div>2)</div><div>I have a bunch (two dozen) of little objects that I would like to be able to draw on one canvas. At the moment I am passing each object the drawing context which comes from the canvas, letting the object draw itself and then moving onto the next object. By this method, if one object changes I have to redraw the entire canvas. I know in Java you can redraw only part of the canvas. Is there a standard method in Racket for drawing a bunch of objects on a canvas efficiently?</div>
<div><br></div>