[racket] newb question - image-snip and adjust-cursor

From: Joseph DiMuro (joseph.dimuro at biola.edu)
Date: Wed Jul 9 11:44:24 EDT 2014

Hello fellow Racketeers. I apologize in advance for asking an extremely
dumb question:

I am currently learning about the Graphical Interface Toolkit. I'm trying
to do something that should be very simple: have a pasteboard with a single
image-snip, and have the mouse cursor change to a hand when it is over the
image-snip. Based on what I've read, it seems like I need to create a new
subclass of image-snip%, and override adjust-cursor so that it changes the
mouse cursor into a hand. Here's my code:

#lang racket/gui

(define f (new frame%
               [label "Adjust Cursor Test"]
               [width 250]
               [height 250]))

(define c (new editor-canvas% [parent f]))

(define pb (new pasteboard%))
(send c set-editor pb)

(define hand-cursor-snip%
  (class image-snip%
    (define/override (adjust-cursor dc x y editorx editory event)
      (make-object cursor% 'hand))
    (super-make-object)))

(define ufo (make-object hand-cursor-snip% "ufo.jpg" 'jpeg))
(send pb insert ufo)

(send f show #t)

My ufo picture does appear on the pasteboard, and it can be dragged and
resized as usual. But the mouse cursor doesn't change when it is over the
ufo.

I'm sure this is a facepalm-worthy mistake; I'm a newb at this. What should
I do instead? Thanks in advance.

-Joseph DiMuro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140709/d7d72649/attachment.html>

Posted on the users mailing list.