On Thursday, March 2, 2017 at 7:12:22 PM UTC+8, erich wrote:
> Hi! I have a simple non-editable and non-resizable snip% class that in
> its draw function distinguishes whether it's selected or not. It works
> fine when I select it in a text% with the mouse.
> Now I want to select it in the text% when the user left-clicks on it,
> so I've overridden on-event and tried this:
> (define/public (select-this-snip)
>       (define editor (send (get-admin) get-editor))
>       (define pos (send editor get-snip-position this))
>       (send editor set-position pos (+ pos 1)))

You need to tell the snip admin that the snip needs to be redrawn.  In your 
select-this-snip method, add

    (send (get-admin) needs-update this 0 0 width height)

Where width and height are the dimensions of your snip.

Best Regards,

You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to