GUI behavior problem

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

Hi,

Impossible to tell what’s going wrong with so little information, there is nothing obviously wrong in this piece of code… What do you mean by “many of the commands”?
How do you execute the macro? Did you try with ACLiC? (.x YourMacroName.C[color=#FF0000]++[/color])
Could you provide a running script reproducing the problem?

Cheers, Bertrand.

my guess is that simply calling

mycanvas->Mofified(); mycanvas->Update();
will fix your problem.

Rene

[quote]my guess is that simply calling

Code: Select all
mycanvas->Mofified();
mycanvas->Update();

will fix your problem.

Rene
[/quote]

That did it. Thanks!
Stephen