Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » capture the mouse
capture the mouse [message #460232] Tue, 23 August 2005 02:19 Go to next message
Eclipse UserFriend
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 12: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 06:22 Go to previous messageGo to next message
Eclipse UserFriend
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 06:24 Go to previous messageGo to next message
Eclipse UserFriend
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 09:48 Go to previous messageGo to next message
Eclipse UserFriend
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 10:12 Go to previous messageGo to next message
Eclipse UserFriend
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] Wed, 24 August 2005 20:17 Go to previous message
Eclipse UserFriend
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: Sun Jul 06 08:32:22 EDT 2025

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

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

Back to the top