Context Menu for a Node


Im using TreeApp2 project to build a tree structure for all the employees of an organization, each node displaying an employee. Employees working under other employees are being displayed as child nodes for that node. This is working fine. My requirement is, when the user right-clicks on any node I want to display the Context Menu for that node. I tried but I cannot display it for the node. Can you help me out?
Kind Regards,

When you say “child nodes for that node”, are you saying that you are using sub-graphs?

Hi Jake, <?:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><?:NAMESPACE PREFIX = O />

Im not using any sub-graphs, only nodes created from the TreeApNode class.

Did you override GoObject.GetContextMenu (or GetContextMenuStrip in v3), as many of the samples do?

Hi Walter,

Yes, Im overriding the method. This is the code that I have written.
public override GoContextMenu GetContextMenu(TreeAppView view) { GoContextMenu cm = new GoContextMenu(view); cm.MenuItems.Add(new MenuItem("City", new EventHandler(this.City_Command))); cm.MenuItems.Add(new MenuItem("Department", new EventHandler(this.Dept_Command)));
return cm;}
The error msg is : 'TreeApp.Form1.GetContextMenu(TreeApp.TreeAppView)': no suitable method found to override

No, you’re not overriding GoObject.GetContextMenu if you try to define it on your Form.

If you really don’t want to put that method in your own node class, you could implement a GoView.ObjectContextClicked event handler.