Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » GanttChart - Custom Context Menu
GanttChart - Custom Context Menu [message #1058244] Mon, 13 May 2013 06:38 Go to next message
Alexander von Eich is currently offline Alexander von Eich
Messages: 7
Registered: March 2012
Junior Member
Hi,

via showMenuItemsOnRightClick from the (Abstract)Settings I can enable/disable the context menu in the gant chart which shows menu items for zoom and so on. Now I want to add custom menu items.


ganttChart = new GanttChart(parent,SWT.MULTI,createSettings(),null,null,createLanguageManager());


ganttChart.getMenu() is only null. How can I add own Items to the context menu.

Thanks

Alex
Re: GanttChart - Custom Context Menu [message #1248644 is a reply to message #1058244] Mon, 17 February 2014 08:54 Go to previous message
Alin Vulparu is currently offline Alin Vulparu
Messages: 1
Registered: February 2014
Junior Member
I know this is an old topic but since I haven't found a solution to this problem in the forums i guess it would be ok to post my findings on how to add custom menu items to the context menu.

The solution is rather simple you just have to overwrite the getMenu() method in the GanttEvent. You then just return a menu with the items that you want to add to the context menu.
Here is an example of how this can be done:

class CustomGanttEvent extends GanttEvent
{
	@Override
	public Menu getMenu()
	{
		//Create the menu
		final Menu menu = new Menu( getParentComposite() );
		//Create the menu items you want to add
		final MenuItem menuItem = new MenuItem( menu, SWT.PUSH )
		return menu;
	}
}
Previous Topic:Ganttchart Zoom In/Out problem
Next Topic:I can't find the source code of swtplus 1.0
Goto Forum:
  


Current Time: Thu Aug 28 23:41:11 EDT 2014

Powered by FUDForum. Page generated in 0.01598 seconds