Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » How to get the cell for Nebula grid mouse events?
How to get the cell for Nebula grid mouse events? [message #1758425] Tue, 28 March 2017 14:24 Go to next message
Manuel Mall is currently offline Manuel MallFriend
Messages: 26
Registered: September 2015
Junior Member
We have started porting a substantial RCP based desktop application to RAP. The application makes heavy use of the Nebula grid but so far the port has been amazingly smooth. One problem we are stuck with are our cell specific right click context menus. They use the cell selection feature of the grid to determine the cell which is not supported in RAP. So, if we get a right click event on a grid (or a MenuListener.menuAboutToShow invocation) how can we figure out which cell the click was in?

Thanks
Re: How to get the cell for Nebula grid mouse events? [message #1758462 is a reply to message #1758425] Tue, 28 March 2017 23:07 Go to previous messageGo to next message
Chris Fairhall is currently offline Chris FairhallFriend
Messages: 221
Registered: February 2011
Senior Member
If you have a mouse coordinate, what's wrong with Grid#getItem(Point) : GridItem
That should give you the GridItem for the point, which you should be able to translate from a Display based mouse x,y to a control relative point with Control#toControl(Point) : Point
Re: How to get the cell for Nebula grid mouse events? [message #1758645 is a reply to message #1758462] Fri, 31 March 2017 05:40 Go to previous messageGo to next message
Manuel Mall is currently offline Manuel MallFriend
Messages: 26
Registered: September 2015
Junior Member
Hi Chris, thank you for your hints. It boiled down to that when the context menu action was invoked the grid viewer selection information doesn't contain any column information just the row. To make the column available to the action we added a MenuDetectListener as its event contains a x,y coordinates. These in turn can be used to determine the column through the ColumnViewer.getCell(point) method. We then store the column in the grid's data from where the action handler can retrieve it. May be there are better ways to solve this issue but this seems to work OK.
Re: How to get the cell for Nebula grid mouse events? [message #1758780 is a reply to message #1758645] Sun, 02 April 2017 20:48 Go to previous messageGo to next message
Chris Fairhall is currently offline Chris FairhallFriend
Messages: 221
Registered: February 2011
Senior Member
Be careful relying on the order of events.

If I recall correctly, the Selection event and the MenuDetect event can be processed in different orders depending if the events are sent in the same JSON message or not.
I had an issue with my TableViewer's where Action's that were enabled or disabled based on the Selection event would not be up to date when menu was rendered if the user did a very fast right-click, causing both events to be sent in one request.
Re: How to get the cell for Nebula grid mouse events? [message #1758871 is a reply to message #1758780] Tue, 04 April 2017 01:13 Go to previous message
Manuel Mall is currently offline Manuel MallFriend
Messages: 26
Registered: September 2015
Junior Member
Thank you for the hint about event ordering - I have changed it to use the MouseDown event not the MenuDetect event. The MenuDetect event also appears to be fired after the MenuAboutToShow event which means in some of my use cases that was too late any way.
Previous Topic:How to set RWT.getApplicationContext() in java thread.
Next Topic:Distorded 16x16 icons in Chrome/Firefox
Goto Forum:
  


Current Time: Tue Mar 19 04:50:43 GMT 2024

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

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

Back to the top