Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
900
Resetting/Clearing SetContextMenuUltra
posted

Hi,

I have a form with a TreeView and a ToolbarsManager on it.  I use SetContextMenuUltra() to set the context menu that is displayed on the tree based on the node selected - I have different types of nodes in my tree, and depending on the prefix of their name, a different context menu is shown.

This works fine as long as a node is selected.  However, if no node is selected and the user right-clicks in the treeview, the last-set context menu is shown.  In this case, no context menu should be shown because there is not a node selected.  Is there a way to Clear the Context Menu settings for the treeview in this case?  I couldn't find a ResetContextMenuUltra.  I wasn't sure where else to look.

Thanks,

~Karen

Parents
No Data
Reply
  • 44743
    posted

    You can call SetContextMenuUltra and pass in null or String.Empty as the menuKey to remove the context menu. Alternatively, you can handle the BeforeToolDropdown event. If its the event args's SourceControl property is the tree and it has no selected node, set Cancel to True on the event args.

Children
No Data