TPad::WaitPrimitive comments

From: Maxim Nikulin <nikulin_at_gorodok.net>
Date: Mon, 24 Apr 2006 10:31:43 +0700


Hi,

I faced several problems during my attempts to use the TPad::WaitPrimitive() method and I think these issues should be mentioned in the documentation. I've written a script demonstrating a possible solution, I hope it will be useful for someone.

{

    h = new TH1F ("h", "h", 10, 0, 1);
    h->Draw();
    t = new TText(0.5, 0.5, "Text");

    t->SetName("t");  // otherwise it has empty name ""

// and WaitPrimitive() returns immediately
// TText is not the only class having the empty
// name by default
t->Draw(); for (Int_t i = 0; i < 10; ++i) { h->Fill(i/10. + 0.01); c1->Modified(); c1->Update(); c1->WaitPrimitive(); c1->HandleInput(kNoEvent, 0, 0); // next call of WaitPrimitive() // often receives the same event // so no pause happens cout << i << endl;

    }
}

Another point is that the canvas can be closed while WaitPrimitive() is executed. Probably the code should handle this case.

I don't think input event processing significantly varies for different window managers, but just to be precise. I use Black box window manager, ROOT 5.10/00 and Fedora Core 2 on a Pentium 4 box.

-- 
Maxim Nikulin
Received on Mon Apr 24 2006 - 05:31:50 MEST

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:31:58 MET