Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » SWT mouse event problem
SWT mouse event problem [message #547555] Sun, 18 July 2010 19:39 Go to next message
No real name is currently offline No real nameFriend
Messages: 18
Registered: April 2010
Junior Member
Hello guys,

Ive got some problem which seems to be easy but i dont know if have easy solution and so far i didnt find one. Maybe you can help me.
I have main composite and two others inside which are children. Main composite have got mouse listener for mouseEnter and mouseExit event. Now problem occures when i move mouse from main component inside children one - mouseExit event is invoked on main one becouse mouse move out in some way from this component. I cannot say its not proper behaviour but in my case i dont want it occures becouse it destroys my logic. I want mouseExit behaviour was executed if mouse is out but only from whole parent area, not when move mouse over childrens. How i can get it? I will be thankfull for help and any ideas.

Tom
Re: SWT mouse event problem [message #548757 is a reply to message #547555] Thu, 22 July 2010 21:32 Go to previous message
Lakshmi P ShanmugamFriend
Messages: 279
Registered: July 2009
Location: India
Senior Member
Hi,

What you are seeing is the correct SWT behavior.

You can try this to see if solves your problem --
The MouseEvent has x and y coordinate values of the mouse pointer when mouse enters or exits. You can add a check to see if the coordinates lie inside or outside the parent composite.

composite.addMouseTrackListener(new MouseTrackAdapter() {
		public void mouseExit(MouseEvent e) {
			Rectangle rect = composite.getClientArea();
			if (!rect.contains(e.x, e.y)) {
				//add your composite mouse exit logic here
				System.out.println("composite exit ");
			}
		}
		public void mouseEnter(MouseEvent e) {
			System.out.println("composite enter");
		}
	});




Lakshmi P Shanmugam
Previous Topic:Questions on Search feature
Next Topic:Problem with VirtualTable?
Goto Forum:
  


Current Time: Thu Apr 25 15:59:54 GMT 2024

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

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

Back to the top