Hi Ivan, I have cleaned and simplified your macro. See below Rene Brun int ctest() { int n=0,m=0,k=0,channel; TCanvas *c1 = new TCanvas("c1","Dynamic filling example",950,800); c1->Divide(2,2); c1->SetFillColor(42); c1->GetFrame()->SetFillColor(21); c1->GetFrame()->SetBorderSize(6); c1->GetFrame()->SetBorderMode(-1); c1->cd(1); TH1F *h1= new TH1F("h1","test1",100,-3,3); TH1F *h2= new TH1F("h2","test2",100,-3,3); TH1F *h3= new TH1F("h3","test3",100,-3,3); TH1F *h4= new TH1F("h4","test4",100,-3,3); while (m!=1){ h1->FillRandom("gaus",10); h2->FillRandom("gaus",2); h3->FillRandom("gaus",50); h4->FillRandom("gaus",20); h1->Draw(); c1->cd(2); h2->Draw(); c1->cd(3); h3->Draw(); c1->cd(4); h4->Draw(); c1->cd(1); c1->Update(); gSystem->ProcessEvents(); if (gROOT->IsInterrupted()) m=1; //if "view - interrupt" is selected } } Ivan Storgaard Vogelius wrote: > > Hi! > The following peace of code works like a blizz in interpreter > mode, but when compiling the canvas is not divided. I can't see why. > > thanks for any help > Ivan > > int ctest() { > int n=0,m=0,k=0,channel; > TCanvas *c1 = new TCanvas("c1","Dynamic filling example",950,800); > c1->Divide(2,2); > c1->SetFillColor(42); > c1->GetFrame()->SetFillColor(21); > c1->GetFrame()->SetBorderSize(6); > c1->GetFrame()->SetBorderMode(-1); > TPad *c1_1 = (TPad*)(c1->GetPrimitive("c1_1")); //should be TCanvas*...? > TPad *c1_2 = (TPad*)(c1->GetPrimitive("c1_2")); > TPad *c1_3 = (TPad*)(c1->GetPrimitive("c1_3")); > TPad *c1_4 = (TPad*)(c1->GetPrimitive("c1_4")); > c1_1->Draw(); > c1_2->Draw(); > c1_3->Draw(); > c1_4->Draw(); > c1->cd(1); > TH1F *h1= new TH1F("h1","test1",100,-3,3); > TH1F *h2= new TH1F("h2","test2",100,-3,3); > TH1F *h3= new TH1F("h3","test3",100,-3,3); > TH1F *h4= new TH1F("h4","test4",100,-3,3); > for (;;){ > while (m!=1){ > h1->FillRandom("gaus",10); > h2->FillRandom("gaus",2); > h3->FillRandom("gaus",50); > h4->FillRandom("gaus",20); > h1->Draw(); > //c1_2->Draw(); > c1->cd(2); > h2->Draw(); > //c1_3->Draw(); > c1->cd(3); > h3->Draw(); > //c1_4->Draw(); > c1->cd(4); > h4->Draw(); > c1->cd(1); > c1->Update(); > gSystem->ProcessEvents(); > if (gROOT->IsInterrupted()) m=1; //if "view - interrupt" is selected > in window: exit loop > }
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:46 MET