[racket] update canvas image

From: 김태윤 (kty1104 at gmail.com)
Date: Wed Oct 27 08:22:51 EDT 2010

hello thank you for your replying
So you want the refresh method?
no.
you can imagine one picture and if you click some point in the picture, then
circle that point
my code can't update circled picture
could you give me little advice?

2010/10/27 Robby Findler <robby at eecs.northwestern.edu>

> So you want the refresh method?
>
> Robby
>
> On Wednesday, October 27, 2010, 김태윤 <kty1104 at gmail.com> wrote:
> > doesn't working properly means I can't update my canvas by this
> methodcould somebody tell me how to update canvas with changed image? (when
> some function is evaluated)
> >
> > 2010/10/27  <kty1104 at gmail.com>
> > hello~
> > I am making map editor
> > one of the editor's ability is select tile image from chip-set(kind of
> town map tile) image
> > and circle the selected tile
> > 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.
> > could somebody give me an little advice?
> >
> > #lang scheme/gui
> > (require 2htdp/image)
> > (define pic dc<%>)
> > (define chipset (make-object bitmap% "town.png" 'png))
> > (define f (instantiate frame% ("map editor")))
> > (define mcan%
> >   (class canvas%
> >
> >     (override on-event on-paint)
> >     (define on-paint
> >       (λ () (send (send this get-dc) draw-bitmap chipset 0 0)))
> >     (define on-event (λ (e)
> >                        (send msg set-label
> >                              (string-append (number->string (floor (/
> (send e get-x) 16))) " "
> >                                             (number->string (floor (/
> (send e get-y) 16)))))
> >                        (when (send e get-left-down)
> >                          (begin (set! chipset (place-image (circle 8
> "outline" "orange")
> >                                                            (send e get-x)
> >                                                            (send e get-y)
> >                                                            chipset))
> >                                 (send f refresh)));it doesn't seems to
> good way
> >                        ))
> >     (super-instantiate ())))
> >
> > (define mcan (new mcan% (parent f) (min-width (image-width chipset))
> (min-height (image-height chipset))))
> >
> > (define msg (instantiate message% ("nothing so far" f)))
> > (define tile-width-field (instantiate text-field% ("width") (init-value
> "16") (parent f) (stretchable-width #f)))
> >
> > (define tile-height-field (instantiate text-field% ("height") (init-value
> "16") (parent f) (stretchable-width #f)))
> >
> > (send f show #t)
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20101027/ac104b46/attachment.html>

Posted on the users mailing list.