How to stop running a macro through control bar (fwd)

Wei Xie (xiewei@ceropa.weizmann.ac.il)
Mon, 18 May 1998 10:15:32 +0200 (EET)


Dear ROOTers,

I execute the "button.C" first and click with mouse on
the button to activate "oo.C". But after that I can not stop unless to
kill it through keyboard. Ctr-C does not make effect on this. Please
give some help

Sincerely yours

Xie

***********
button.C *
***********

{
gROOT->Reset();
bar = new TControlBar("vertical", "Demos");

bar->AddButton("activate oo.C",".x oo.C", "test for oo.C");
bar->AddButton("Close", "delete bar", "Delete control bar");
bar->Show();
gROOT->SaveContext();
}

*******
oo.C *
*******

{
gROOT->Reset();
test = new TCanvas("test","",0,0,700,500);
pad1 = new TPad("p1","",0.0, 0.0, 0.48, 0.9, 21);
pad2 = new TPad("p2","",0.52, 0.0, 1.0, 0.9, 21);
pad1->GetFrame()->SetFillColor(42);
pad2->GetFrame()->SetFillColor(42);
pad1->SetGrid();
pad2->SetGrid();
pad1->Draw();
pad2->Draw();

hist1 = new TH1F("h1","1st test hist",100, -4,4);
hist2 = new TH1F("h2","2nd test hist",100, -4,4);
ntuple = new TNtuple("ntuple","","x1:x2");

hist1->SetMarkerSize(0.7);
hist1->SetMarkerStyle(20);
ntuple->SetMarkerStyle(21);

hist2->SetFillColor(48);

gRandom->SetSeed();

float x1,x2;

for(int i=0;i<100000;i++)
{
x1 = gRandom->Gaus(-1,1.5);
x2 = gRandom->Gaus(-0.5,0.5);

hist1->Fill(x1);
hist2->Fill(x2);
ntuple->Fill(x1,x2);

if(!i%500)
{
pad1->cd();
hist1->Draw("elp");
hist2->Draw("same");
pad2->cd();
ntuple->Draw("x1:x2","x2>=0");
test->Modified();
test->Update();
}
}

test->Update();

}