doesn't working properly means I can't update my canvas by this method<div>could somebody tell me how to update canvas with changed image? (when some function is evaluated)<br><br><div class="gmail_quote">2010/10/27 <span dir="ltr"><<a href="mailto:kty1104@gmail.com">kty1104@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">hello~<br>I am making map editor<br>one of the editor's ability is select tile image from chip-set(kind of town map tile) image<br>
and circle the selected tile<br>I made a following code but I don't think that this is good way to update image and it doesn't working properly as well.<br>could somebody give me an little advice?<br><br>#lang scheme/gui<br>
(require 2htdp/image)<br>(define pic dc<%>)<br>(define chipset (make-object bitmap% "town.png" 'png))<br>(define f (instantiate frame% ("map editor")))<br>(define mcan% <br> (class canvas%<br>
<br> (override on-event on-paint)<br> (define on-paint<br> (λ () (send (send this get-dc) draw-bitmap chipset 0 0)))<br> (define on-event (λ (e) <br> (send msg set-label <br> (string-append (number->string (floor (/ (send e get-x) 16))) " " <br>
(number->string (floor (/ (send e get-y) 16)))))<br> (when (send e get-left-down) <br> (begin (set! chipset (place-image (circle 8 "outline" "orange") <br>
(send e get-x) <br> (send e get-y) <br> chipset)) <br>
(send f refresh)));it doesn't seems to good way<br> ))<br> (super-instantiate ())))<br><br>(define mcan (new mcan% (parent f) (min-width (image-width chipset)) (min-height (image-height chipset))))<br>
<br>(define msg (instantiate message% ("nothing so far" f)))<br>(define tile-width-field (instantiate text-field% ("width") (init-value "16") (parent f) (stretchable-width #f)))<br><br>(define tile-height-field (instantiate text-field% ("height") (init-value "16") (parent f) (stretchable-width #f)))<br>
<br>(send f show #t)</blockquote></div><br></div>