[racket] how can I get canvas's x and y? when it is scrolled?

From: Roman Klochkov (kalimehtar at mail.ru)
Date: Wed Jun 19 01:06:40 EDT 2013

( send   a-canvas   get-view-start ) 

Then add to get-x/get-y

Среда, 19 июня 2013, 13:47 +09:00 от 김태윤 <kty1104 at gmail.com>:
>how can I get image's x and y?
>
>in short, the scrollbar was moved so I can see image's area whose x
>and y are from 90, 90 to 290, 290.
>
>at this moment, I move mouse to upper-left corner of the window. and get 0,0.
>
>but I want to get 90,90.
>
>how can I do this?
>
>thanks!
>
>here my code
> #lang racket/gui
>(require racket/draw)
>
>(define f
>  (new frame%
>       [label "hey"]
>       [width 200]
>       [height 200]))
>
>(define img (read-bitmap "some_image.png"))
>(define img-w (send img get-width))
>(define img-h (send img get-height))
>
>(define (pcb c dc)
>  (send dc draw-bitmap img 0 0))
>
>(define my_c%
>  (class canvas%
>    (define/override (on-event e)
>      (printf "x: ~a y: ~a \n" (send e get-x) (send e get-y)))
>    (super-new)))
>
>(define c (new my_c%
>               [parent f]
>               [style (list 'hscroll 'vscroll)]
>               [paint-callback pcb]))
>
>(send c init-auto-scrollbars img-w img-h 0 0)
>
>(send f show #t)
>____________________
>  Racket Users list:
>   http://lists.racket-lang.org/users


-- 
Roman Klochkov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130619/16061c8c/attachment.html>

Posted on the users mailing list.