Tracking mouse outside my window.

View: New views
6 Messages — Rating Filter:   Alert me  

Tracking mouse outside my window.

by rawhite :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi All,

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?

I've fooled around a little bit with the win32/api stuff trying to
install a mouse hook, to no avail.

Thanks in advance for any suggestions/guidance anyone has to offer.
Especially welcome would be, 'You dufus! The FxFranastat widget does
exactly that!"  :-)


Cheers,
--Bob
_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users

Re: Tracking mouse outside my window.

by Lyle Johnson-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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  
button again.

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,

Lyle

---
"FXRuby: Create Lean and Mean GUIs with Ruby"
Now available from the Pragmatic Bookshelf!
http://www.pragprog.com/titles/fxruby





_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users

Re: Tracking mouse outside my window.

by rawhite :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Lyle,

On Sun, Jun 22, 2008 at 3:51 PM, Lyle Johnson <lyle@...> wrote:

>
> 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 button again.
>
> 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,
>
> Lyle

Thanks so much for the response, Lyle.  Yes, that's exactly the widget
I was seeking.  I've been trying to learn my way around through the
widget set, but I'd not noticed that one.  It's not an emergency for
me, and I'm pleased to await the update release.

BTW, your book is *really* nicely done.  I'm incredibly pleased with
my purchase of it.  Thanks for the incredibly nice work you're letting
me take advantage of.

Cheers,
--Bob
_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users

Re: Tracking mouse outside my window.

by Lyle Johnson-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Jun 23, 2008, at 7:36 PM, Bob Whiteside wrote:

> Thanks so much for the response, Lyle.  Yes, that's exactly the widget
> I was seeking.  I've been trying to learn my way around through the
> widget set, but I'd not noticed that one.  It's not an emergency for
> me, and I'm pleased to await the update release.

OK. I'm looking into a couple of other recently reported problems to  
see what else I can squeeze into this release.

> BTW, your book is *really* nicely done.  I'm incredibly pleased with
> my purchase of it.  Thanks for the incredibly nice work you're letting
> me take advantage of.

Thanks, I'm glad you're enjoying it!

---
"FXRuby: Create Lean and Mean GUIs with Ruby"
Now available from the Pragmatic Bookshelf!
http://www.pragprog.com/titles/fxruby





_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users

Re: Tracking mouse outside my window.

by rawhite :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, Jun 23, 2008 at 6:37 PM, Lyle Johnson <lyle@...> wrote:

>
> OK. I'm looking into a couple of other recently reported problems to see
> what else I can squeeze into this release.
>

Do you happen to know whether the FXPicker consumes the foreign mouse
click, or sends it on through in addition to reporting it back to the
widget?

Oh, I guess I should learn to examine the Fox site to learn such thing.

Cheers,
--Bob
_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users

Re: Tracking mouse outside my window.

by Stevenson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Can you provide some code written for SEL_CHANGED event method?

Thanks.

rawhite wrote:
Hi All,

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?

I've fooled around a little bit with the win32/api stuff trying to
install a mouse hook, to no avail.

Thanks in advance for any suggestions/guidance anyone has to offer.
Especially welcome would be, 'You dufus! The FxFranastat widget does
exactly that!"  :-)


Cheers,
--Bob
_______________________________________________
fxruby-users mailing list
fxruby-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/fxruby-users