Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Detect right click on tab?
Detect right click on tab? [message #778494] Thu, 12 January 2012 20:58 Go to next message
Missing name Mising name is currently offline Missing name Mising nameFriend
Messages: 105
Registered: December 2010
Senior Member
I have a CTabFolder with CTabItems.
Is there any way to detect a right-click on the tab?
Re: Detect right click on tab? [message #778628 is a reply to message #778494] Fri, 13 January 2012 15:08 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
You need to do something like the following:

folder.addListener(SWT.MouseDown, new Listener() {
public void handleEvent(Event event) {
if (event.button != 3) return;
CTabItem item = folder.getItem(new Point(event.x, event.y));
if (item != null) {
System.out.println("Right-clicked on " + item.getText());
}
}
});

I notice that for non-simple CTabFolders it does not properly take into
account the curve between the selected tab and the other tabs, so I've
logged https://bugs.eclipse.org/bugs/show_bug.cgi?id=368550 for this.
If this is important in your context (ie.- using a non-simple CTabFolder
is not possible) then you could likely workaround this in your app by
special-casing the case of a mouse-down in the currently-selected tab,
and computing whether the click is above or below where its curve would
be (look in CTabFolder's source to see the drawing of the line). This
is obviously something that would become broken if CTabFolders were to
change their appearance in the future, but I'm not aware of any such
plans at this point.

HTH,
Grant


On 1/12/2012 3:58 PM, Missing name Mising name wrote:
> I have a CTabFolder with CTabItems.
> Is there any way to detect a right-click on the tab?
>
Re: Detect right click on tab? [message #778640 is a reply to message #778628] Fri, 13 January 2012 15:52 Go to previous message
Missing name Mising name is currently offline Missing name Mising nameFriend
Messages: 105
Registered: December 2010
Senior Member
Thanks! That should do what I need.
Previous Topic:MultiPageFormEditor switch Tab on Key Event
Next Topic:Configuring Log4j
Goto Forum:
  


Current Time: Fri Apr 26 07:06:14 GMT 2024

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

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

Back to the top