Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » capture the mouse
capture the mouse [message #460232] Tue, 23 August 2005 06:19 Go to next message
Don Young is currently offline Don YoungFriend
Messages: 18
Registered: July 2009
Junior Member
How can I capture the mouse within a client area of a Composite such
that the mouse cannot click outsite the rectangular area designated?

Thanks

Don
Re: capture the mouse [message #460280 is a reply to message #460232] Tue, 23 August 2005 16:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sunil_kamath.nohotspammail.com

"Don Y" <don@inpowersoft.com> wrote in message
news:deef65$29v$2@news.eclipse.org...
> How can I capture the mouse within a client area of a Composite such that
> the mouse cannot click outsite the rectangular area designated?
>
I don't know if there is a non platform-specific way to do it.
However, on Windows you can use the ClipCursor API to do it.
---
Sunil
Re: capture the mouse [message #460347 is a reply to message #460232] Wed, 24 August 2005 10:22 Go to previous messageGo to next message
Asim Ullah is currently offline Asim UllahFriend
Messages: 24
Registered: July 2009
Junior Member
Don Y wrote:
> How can I capture the mouse within a client area of a Composite such
> that the mouse cannot click outsite the rectangular area designated?

Have a look at java.awt.Robot
and moveMove().
Re: capture the mouse [message #460350 is a reply to message #460347] Wed, 24 August 2005 10:24 Go to previous messageGo to next message
Asim Ullah is currently offline Asim UllahFriend
Messages: 24
Registered: July 2009
Junior Member
Asim Ullah wrote:

> Don Y wrote:
>> How can I capture the mouse within a client area of a Composite such
>> that the mouse cannot click outsite the rectangular area designated?

> Have a look at java.awt.Robot
> and moveMove().
^^^^^^^^
that is mouseMove()!
Re: capture the mouse [message #460387 is a reply to message #460232] Wed, 24 August 2005 13:48 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
Hi Don,

You cannot reliably restrict the pointer from exiting a rectangle. There is
a method Display.setCursorLocation() that would let you move the pointer
back into the rectangle whenever it left, but this is considered to be bad
UI practice and is not offered on all platforms (notably GTK).

However if you meant capture in the traditional sense of having your
composite always notified of mouse events even if the mouse is outside of
it, then you can use Control.setCapture(true).

Grant

"Don Y" <don@inpowersoft.com> wrote in message
news:deef65$29v$2@news.eclipse.org...
> How can I capture the mouse within a client area of a Composite such
> that the mouse cannot click outsite the rectangular area designated?
>
> Thanks
>
> Don
Re: capture the mouse [message #460393 is a reply to message #460232] Wed, 24 August 2005 14:12 Go to previous messageGo to next message
Alex Blewitt is currently offline Alex BlewittFriend
Messages: 946
Registered: July 2009
Senior Member
Not only is there no easy way of doing it, it's certainly bad practice to do so.

In any case, even if you could do this it would be trivial to change to another application (e.g. Alt+Tab) and then go back into your application in a different position.

Why not use a modal Dialog instead? That way, the user can move the mouse around but not do anything with the application until after the operation is complete.
Re: capture the mouse [message #460407 is a reply to message #460393] Thu, 25 August 2005 00:17 Go to previous message
Don Young is currently offline Don YoungFriend
Messages: 18
Registered: July 2009
Junior Member
Alex Blewitt wrote:
> Not only is there no easy way of doing it, it's certainly bad practice to do so.
>
> In any case, even if you could do this it would be trivial to change to another application (e.g. Alt+Tab) and then go back into your application in a different position.
>
> Why not use a modal Dialog instead? That way, the user can move the mouse around but not do anything with the application until after the operation is complete.

That's our conclusion after some digging ins...
Previous Topic:Setting the size of a composite, then addLayout() ?
Next Topic:Uninitialise plugin
Goto Forum:
  


Current Time: Tue Apr 16 11:19:39 GMT 2024

Powered by FUDForum. Page generated in 0.30429 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top