Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Nattable menu invocation when table is empty
Nattable menu invocation when table is empty [message #1697557] Thu, 04 June 2015 21:01 Go to next message
Marti DeMore is currently offline Marti DeMoreFriend
Messages: 1
Registered: July 2009
Junior Member
I have an SWT composite that contains a Nattable (as Grid) and nothing else. I have added my own items to the menu attached to the BODY area of the grid. Some of these items need to be accessible when there are no rows in the table, but the menu will not come up if there are no rows in the table. I tried attaching the menu both to the BODY region and the GRID region, but no luck. (The latter results in no menu at all).

On the Mac I got around this by attaching a second menu to the underlying composite, and having a menu detect listener on that menu that allows that menu to come up only when the table is empty (otherwise I get BOTH menus). This way I get the table menu if there are rows, and the other SWT menu if there are not.

On RedHat Linux with Gnome desktop this does not work. The mouse event does not appear to get through to the composite. The menu detect listener on the menu attached to the Nattable grid body does get triggered, but that menu still does not come up. How can a MenuDetectListener get invoked, but there is still NO MENU??

It is not acceptable to attach the table just to the ROW HEADER area of the grid. For one thing, my row header must be hideable. For another, my user is staring at a large blank composite where the table rows would normally be. The natural behavior is to expect to click anywhere in that composite and see the basic menu, not to have to locate the mouse in the table header first.
Re: Nattable menu invocation when table is empty [message #1697632 is a reply to message #1697557] Fri, 05 June 2015 13:49 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2803
Registered: July 2012
Senior Member
If there are no rows, there is no body. That is how NatTable works.

On RedHat Linux with Gnome desktop this does not work.

Sounds like an SWT issue, not related to NatTable. Attaching a menu to the composite or the NatTable via SWT menu mechanism would have been the same approach I would have suggested. Did you try attaching it to the NatTable? The PopupMenuBuilder stuff is NatTable internal stuff for handling context menus.

It is not acceptable

This sounds like you are blaming me for something. And in such a case my answer is typically "if you don't like it, you don't have to use it!"

But as I said, the PopupMenuBuilder stuff is NatTable internal. And it can not work if nothing is rendered. That is the behavior. If you need a context menu that also works if nothing is rendered, the popup menu needs to be registered the SWT way. I suppose it should work when registering the menu to the NatTable instance, not the underlying composite.
Previous Topic:Set NatTable readonly
Next Topic:SpanningDataLayer paint problems when scrolling fast
Goto Forum:

Current Time: Fri Feb 26 04:55:56 GMT 2021

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

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

Back to the top