Skip to main content

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 10:38 Go to next message
Alexander von Eich is currently offline Alexander von EichFriend
Messages: 7
Registered: March 2012
Junior Member

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.


Re: GanttChart - Custom Context Menu [message #1248644 is a reply to message #1058244] Mon, 17 February 2014 13:54 Go to previous message
Alin Vulparu is currently offline Alin VulparuFriend
Messages: 5
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
	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: Sat Apr 13 03:49:56 GMT 2024

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

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

Back to the top