Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Mouse Event Handling Problem
icon9.gif  Mouse Event Handling Problem [message #1384997] Tue, 03 June 2014 14:12 Go to next message
Michael Heiss is currently offline Michael HeissFriend
Messages: 20
Registered: November 2013
Location: Graz, Austria
Junior Member
Hi,

We have some mouse event handling troubles and I would need some suggestions how to fix them. The problem is that the context menu of the table - that is shown as a result when the user right clicks - is not always showing up. Scenario that is not working:

- Select a cell by clicking the left mouse button
- Press and hold the right mouse button
- Move the mouse a little bit within the cell
- Release the right mouse button
= The action is not executed and nothing happens

The behaviour is also producible with the example application. Just change the code that attaches the debug menu (DebugMenuConfiguration) to use the registerSingleClickBinding API instead of the registerMouseDownBinding API to attach the menu. Open the application and select "Tutorial Examples" -> "Integration" -> "GroupBySummaryRowExample".

I debugged a little bit into the MouseModeEventHandler and the error happens when this handler gets a mouse-move event. When this happens the mode is switched back to 'normal' and the mouse-up event is not handled any more. Thus the context menu is not shown.

My suggested fix would be to get rid of the mode-switching during a mouse-move event. The switching happens anyhow when the mouse button is released again.
Thus it would look like:
MouseModeEventHandler:
	@Override
	public synchronized void mouseMove(MouseEvent event) {
		if (mouseDown && dragMode != null) {
			if (natTable.commitAndCloseActiveCellEditor()) {
				dragMode.mouseDown(natTable, initialMouseDownEvent);
				switchMode(new DragModeEventHandler(getModeSupport(), natTable, dragMode, this, initialMouseDownEvent));
			}
		}
	}


Any comments or even better solutions for this problem?

Best Regard,
Michael
Re: Mouse Event Handling Problem [message #1385005 is a reply to message #1384997] Tue, 03 June 2014 14:59 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Doing this would remove the ability to add effects on dragging.

The solution should be to check whether the mouse up was done on the same cell as the mouse down and in such a case execute the action rather than dragging.

I thought I fixed this already for 1.1. Try to do a left click on a sortable header, move the mouse but stay in the cell and do a mouse up. This should execute a sort operation. Before no action was performed. Maybe the case you explained is not matched.
Re: Mouse Event Handling Problem [message #1385067 is a reply to message #1385005] Wed, 04 June 2014 07:29 Go to previous messageGo to next message
Michael Heiss is currently offline Michael HeissFriend
Messages: 20
Registered: November 2013
Location: Graz, Austria
Junior Member
Clicking on a sortable header and then dragging the mouse within the cell results in the same issue. Thus no sort is executed.
Re: Mouse Event Handling Problem [message #1385085 is a reply to message #1385067] Wed, 04 June 2014 09:21 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
I disaggree. In the examples app that can be started from our webpage it works that way.

Which version are you using?
Re: Mouse Event Handling Problem [message #1385089 is a reply to message #1385085] Wed, 04 June 2014 09:36 Go to previous messageGo to next message
Michael Heiss is currently offline Michael HeissFriend
Messages: 20
Registered: November 2013
Location: Graz, Austria
Junior Member
I'm using the latest version from the master and started the sample application from my workspace. Head is at 97a2ad3614bc23a473e4b6a6403c25720f1321d3.
Re: Mouse Event Handling Problem [message #1385091 is a reply to message #1385089] Wed, 04 June 2014 09:50 Go to previous messageGo to next message
Michael Heiss is currently offline Michael HeissFriend
Messages: 20
Registered: November 2013
Location: Graz, Austria
Junior Member
Hmm ok ... seems that for the header it's really working. But my initial issue remain Sad
Re: Mouse Event Handling Problem [message #1385093 is a reply to message #1385091] Wed, 04 June 2014 10:03 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
I guess the existing logic is not interpreting the right click correctly. But it should behave the same way.

Please create a ticket. I will see if I find the time to fix it the next weeks.

Or maybe you are able to fix it and contribute.
Re: Mouse Event Handling Problem [message #1385396 is a reply to message #1385093] Fri, 06 June 2014 06:57 Go to previous messageGo to next message
Michael Heiss is currently offline Michael HeissFriend
Messages: 20
Registered: November 2013
Location: Graz, Austria
Junior Member
I created a ticket for this issue: https://bugs.eclipse.org/bugs/show_bug.cgi?id=436770

Re: Mouse Event Handling Problem [message #1387096 is a reply to message #1385396] Tue, 24 June 2014 06:14 Go to previous messageGo to next message
Michael Heiss is currently offline Michael HeissFriend
Messages: 20
Registered: November 2013
Location: Graz, Austria
Junior Member
Any updates on the issue?
Re: Mouse Event Handling Problem [message #1387142 is a reply to message #1387096] Tue, 24 June 2014 11:46 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
No. Currently I don't have much time to look into issues.
Re: Mouse Event Handling Problem [message #1387261 is a reply to message #1387142] Tue, 24 June 2014 21:53 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Seems I've found the issue. I commented on the ticket. Will see if I can provide a fix the next days.
Re: Mouse Event Handling Problem [message #1387644 is a reply to message #1387261] Wed, 25 June 2014 11:28 Go to previous message
Michael Heiss is currently offline Michael HeissFriend
Messages: 20
Registered: November 2013
Location: Graz, Austria
Junior Member
Thanks for the update Smile
For our current release (at the end of this week) we are using a workaround as we do not want to have a private forked version in our target platform.

For anybody interested: Instead of registering a single-click binding we do register a mouse listener on the widget and handle the event by our self.


Previous Topic:How to efficient upadate the whole data of a NatTable?
Next Topic:Adding Labels to specific cells
Goto Forum:
  


Current Time: Tue Apr 23 06:37:38 GMT 2024

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

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

Back to the top