[fxruby-users] Tracking mouse outside my window.
lyle at lylejohnson.name
Sun Jun 22 18:51:05 EDT 2008
On Jun 15, 2008, at 11:54 PM, Bob Whiteside wrote:
> I seek general guidance about an aspect of app I'd like to write in
> Ruby/FXRuby. Imagine something like a "point picker" written in
> Ruby. There's a little window that has a "crosshair" button (or
> something) and an area for displaying coordinates. I'd like to drag
> from the crosshairs off to anywhere on the screen. As the mouse is
> dragged, I want to display the coordinates.
> I don't have my heart set on any particular UI gesture. For example,
> if the user could click on the crosshairs, then click somewhere else,
> that'd be fine, too.
> The main issue is that I want to watch mouse events even when the
> cursor is not over the FXRuby window.
> Is this possible?
Yes, and there's already a widget that does most or all of what you
want: the FXPicker widget. The FXPicker is like a button, but when you
click it, it goes into "pick" mode and the cursor changes shape to
crosshairs. Then you can move the cursor around the screen, and the
picker will send a SEL_CHANGED message as it moves, telling you its
new location on screen. You exit "pick" mode when you click on the
Unfortunately, it looks like there's a bug with FXPicker in the
current release of FXRuby, so I'll try to get out a bug fix release
soon to take care of that.
Hope this helps,
"FXRuby: Create Lean and Mean GUIs with Ruby"
Now available from the Pragmatic Bookshelf!
More information about the fxruby-users