Re: [ROOT] Problem when I close a TCanvas

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Jul 06 2001 - 15:13:06 MEST


Hi Matthieu,

I am not sure that it is a good idea to put a TButton in a TCanvas when
the button can clear the canvas. Use a simple TControlBar object instead
or better use a real GUI button. See examples in $ROOTSYS/test/guitest.cxx
or guiviewer.cxx

Rene Brun

Matthieu Tristram wrote:
> 
> Hi Rooters !
> 
> I'm a new user of ROOT, and I have a little problem when I want to close a
> TCanvas.
> I want to make a sort of Navigation Bar for several plots, so I have a
> code like :
> 
> void Plot_test() {
>   TCanvas     *test = new TCanvas("test", "TEST", 10, 10, 500, 200);
> 
>   test->Clear();
>   TPad *testCanvas_1 = new TPad("testCanvas_1",
> "testCanvas_1",0.00117096,0.110843,0.998829,0.998795);
> ...
> my plot
> ...
>   testCanvas_2 = new TPad("testCanvas_2",
> "testCanvas_2",0.00117096,0.00120482,0.998829,0.110843);
>   testCanvas_2->Draw();
>   TButton *button = new
> TButton("Close","test->Close();",0.131455,0.10989,0.275822,0.89011);
>   button->Draw();
> 
>   TButton *but1 = new TButton("Next", "test->Close();Plot_test();", 0.60,
> 0.1, 0.75, 0.9);
>   but1->Draw();
> 
>    test->cd();
> }
> 
> And it happens several times that when a click on the Next button, a "***
> Break *** segmentation violation" appears.
> I test some other way to close my TCanvas, but it seems to be the most
> stable.
> 
> I'm using Root 3.00/06.
> 
> Can anybody help me ?
> 
> Regards.
> Matthieu Tristram.



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:51 MET