Hello,
I’m having an odd problem with a GUI I’ve created for a script I wrote. Everything works, but many of the commands are not fully executed until I go back to the root prompt and press return.
I’m running Ubuntu 10.04 and using Root 5.26.
Here’s the code for one of the offending GUI buttons and the function it executes.
TGTextButton *DrawTraces = new TGTextButton(ScopeFrame,"Draw Traces");
DrawTraces->SetTextJustify(36);
DrawTraces->SetMargins(0,0,0,0);
DrawTraces->SetWrapLength(-1);
DrawTraces->Resize(79,22);
DrawTraces->Connect("Clicked()","Scope",this,"DrawTraces()");
[code]
void Scope::DrawTraces()
{
TClonesArray &traces=*tholder;
TClonesArray &peaks=*pholder;
if(!mycanvas)CreateCanvas(); //doesn’t work for some reason
for(Int_t l=0;l<4;l++)
{
mycanvas->cd(l+1);
((TGraph*) traces[*event*4+l])->GetXaxis()->SetTitle("Tics");
((TGraph*) traces[*event*4+l])->GetYaxis()->SetTitle("ADC counts");
((TGraph*) traces[*event*4+l])->SetLineColor(4);
((TGraph*) peaks[*event*4+l])->SetMarkerColor(2);
if(overlaytraces==0)
{
((TGraph*) traces[*event*4+l])->Draw("LA");
if(binhighlight==true)BinMark(l);
}
else
{
((TGraph*) traces[*event*4+l])->Draw("L");
}
if(((TGraph*) peaks[*event*4+l])->GetN()!=0 && PeakMark==true)
{
mycanvas->cd(l+1);
((TGraph*) peaks[*event*4+l])->Draw("*");
}
}
if(overlaytraces==0)cout<<"Event number: "<<*event<<" drawn."<<endl;
}[/code]
Thanks