Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Active context menu via left mouse click
Active context menu via left mouse click [message #451078] Tue, 22 February 2005 23:02 Go to next message
Rajeev Sudra is currently offline Rajeev SudraFriend
Messages: 30
Registered: July 2009
Member
Is there a way to show the context menu on a control (such as a TableTree)
via a single left mouse click?

I have registered a listener on the control to handle SWT.mouseDown events
which creates a new shell containing a TableViewer to mock up a context
menu but would much rather reuse the existing context menu handling code
to achieve this.

I think I have to capture a SWT.mouseDown event which in turn will
generate an approriate right mouse down event and redispatch it but have
no idea how to implement this.

Any help with code snippets would be great.
Thanks,
Raj
Re: Active context menu via left mouse click [message #451111 is a reply to message #451078] Wed, 23 February 2005 13:55 Go to previous messageGo to next message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
Try using an SWT._POP_UP menu and using Menu.setVisible() to show it.

"Rajeev Sudra" <rsudra@hotmail.com> wrote in message
news:cvgdlv$1ve$1@www.eclipse.org...
> Is there a way to show the context menu on a control (such as a TableTree)
> via a single left mouse click?
>
> I have registered a listener on the control to handle SWT.mouseDown events
> which creates a new shell containing a TableViewer to mock up a context
> menu but would much rather reuse the existing context menu handling code
> to achieve this.
>
> I think I have to capture a SWT.mouseDown event which in turn will
> generate an approriate right mouse down event and redispatch it but have
> no idea how to implement this.
>
> Any help with code snippets would be great.
> Thanks,
> Raj
>
>
Re: Active context menu via left mouse click [message #451132 is a reply to message #451111] Thu, 24 February 2005 01:53 Go to previous messageGo to next message
Rajeev Sudra is currently offline Rajeev SudraFriend
Messages: 30
Registered: July 2009
Member
Many thanks for the pointer. In the end I create a menu manager, add some
actions to it, call createPartControl() with my table tree parent control
and then get the menu from the manager and set it to visible.

Works really well - many thanks.
Raj
Re: Active context menu via left mouse click [message #451133 is a reply to message #451111] Thu, 24 February 2005 01:54 Go to previous message
Rajeev Sudra is currently offline Rajeev SudraFriend
Messages: 30
Registered: July 2009
Member
Many thanks for the pointer. In the end I create a menu manager, add some
actions to it, call createPartControl() with my table tree parent control
and then get the menu from the manager and set it to visible.

Works really well - many thanks.
Raj
Previous Topic:eclipse applet
Next Topic:A widget with a possibility to write with different (in size) fonts
Goto Forum:
  


Current Time: Sat Apr 20 00:14:46 GMT 2024

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

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

Back to the top