[plt-scheme] GUI and mouse wheel

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri Oct 28 11:11:33 EDT 2005

At Fri, 28 Oct 2005 15:53:19 +0200 (CEST), Ivanyi Peter wrote:
> Why does a mouse wheel event belong to keyboard events???

I think I probably implemented it first under Windows, where scroll
events are delivered to the window with the keyboard focus.

> I tried to look around in other Graphical Window Toolkits
> and I think it is usually a mouse event.

That's the better choice, I think.

> Why is it a problem
> for me? Because a graphical widget, like canvas, would
> receive it only if it has focus, but if I have any editor,
> text-field then the canvas will not have focus too often. I
> could program around, that whenever the mouse enters the
> canvas, the canvas gets focus, but I have bad experience
> with the detection of mouse entering and leaving a widget or
> window.

Do you have control over the frame? If so, instead of moving the
keyboard focus, it's probably better to keep track of where the mouse
is using enter and leave event; then override `on-subwindow-char' in
the frame to redirect wheel events to the canvas when the mouse is
there. Or, depending on your application, it might be best to *always*
redirect scroll events to the canvas, independent of the mouse
location (so you don't have to worry about enter and leave events).

Meanwhile, I'll think about how to change MrEd to deliver scroll events
in a platform-appropriate way.


Posted on the users mailing list.