Prevent popup of contextmenu

R

Roland Wolters

Hi,

My treeview has a contextmenu. Using this menu the user can perform an
action on a node.
However, sometimes I do not want the contextmenu to popup. So I catch the
treeview_popup event, check if the contextmenu is to be shown, and show it
(or not). The only thing working here is to dispose the contextmenu but
then it will never be shown again (since it is disposed).

What is the way to do this?


Thanx,

ROland
 
B

Bruce Wood

I have, in a different situation, saved the context menu away in
another variable, like this.savedContextMenu = myControl.ContextMenu,
then set .ContextMenu = null. Then, later, when it is valid to show the
context menu again, I just reassign myControl.ContextMenu =
this.savedContextMenu.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top