Hi,

For me personally, coordinates are probably the most unintuitive aspect
of Racket's GUI management. The problem comes up again and again, and I
never get it right, so maybe someone can clarify this once and for all.

I have a mouse-event% in on-event of a snip% and would like to display
a floating frame% just below the mouse.

Question 1: What is the right way to obtain the window in a potentially
nested hierarchy of editors? I'm currently using:

(define top-window (and-let* ((canvas (get-canvas))
                               (top (send canvas get-top-level-window)))
                      top))

is that correct?

Question 2: How do I obtain the right coordinates for the frame% that I
would like to show below the mouse?

I assume it has something to do with top-window above, but how do I
convert from the coordinates of the mouse-event to the 'right'
coordinates? Currently, the frame% appears offset about 20 to 20 pixels
below the top-window's top-left corner and not at all where the mouse
is located.

Are the mouse-event coordinates relative to the editor? Or relative to
the snip within the editor? How do I convert them?

Question 3: Suppose I want to do the same with a snip% displayed in a
text% with one editor-canvas%, i.e., show a floating window just below
the snip%. Use cases: tooltips, spell corrections, etc.

How do I do that?

Thanks a lot in advance!

Best,

Erich



-- 
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