Programmatically force closing of context menu

Dear all,

I have the following situation :
An histo is displayed in a GUI (TRootBrowser, with tabs, etc…). At a given moment, the histo is replaced with a new one and the former one is deleted. The view is properly updated.

My problem is that users can make a right click on the histo before the replacement but actually click on a menu item after the replacement. This leads to a crash.

Some time ago when I asked a related question (http://root.cern.ch/phpBB2/viewtopic.php?t=9407), I was told to reuse the pointer by using Add(…) or =. However this solution doesn’t copy the “functions” (TLine for instance) from the original histogram.

Is there a way to programmatically cancel the context menu if opened (ie close it when updating) ?
Or to have the contextual menu be able to see that an object is not valid anymore ?
This would greatly ease my life…

Thanks in advance
Barth

Hi Barth,

Sorry, but I don’t see any easy solution for the time being…
I’ll let you know if something can be implemented.

Cheers, Bertrand.

Hello Bertrand,

I can survive without it, it just makes things a bit complicated.

Thanks for your reply,

Barth

Barth,

Working on a solution… Stay tuned!

Cheers, Bertrand.

Hi Barth,

A protection has been implemented in the trunk (revision 32061). Now the context menu will be closed if the selected object is deleted.

Cheers, Bertrand.

Excellent!
I am going to test it now.

Thanks a lot !

Barth

You’re welcome! And if you have any problem, just let us know!

Cheers, Bertrand.

Hi,

I just wanted to let you know that it works well !

Thanks again,
Barth