Dear you,
I want to remove (or block) some items (such as the ‘SetEditable’) from the TCanvas’ contextmenu. Is there a way to do this?
Any help is appreciated.
Handong
Dear you,
I want to remove (or block) some items (such as the ‘SetEditable’) from the TCanvas’ contextmenu. Is there a way to do this?
Any help is appreciated.
Handong
Hi Handong,
Take a look at $ROOTSYS/tutorials/gui/customTH1Fmenu.C and at this simple example:
[code]void removeMenuEntry(const char *classname=“TCanvas”, const char *menuTitle=“SetEditable”)
{
TClassMenuItem *item;
TString itemTitle;
TClass *cl = gROOT->GetClass(“TCanvas”);
cl->MakeCustomMenuList();
TList *ml = cl->GetMenuList();
TIter next(ml);
while ((item =(TClassMenuItem *)next())) {
itemTitle = item->GetTitle();
if (itemTitle == menuTitle) {
delete item;
break;
}
}
}[/code]
Cheers, Bertrand.
Dear Bertrand,
Thank you very much!
It works.
Best Regards,
Handong
Dear Handong,
You’re welcome! And glad to see you solved your problem
Cheers, Bertrand.