Re: Forcing repaints

From: Valery Fine (fine@mail.cern.ch)
Date: Sun Dec 07 1997 - 15:58:55 MET


On  6 Dec 97 at 11:54, William J. Deninger wrote:

> From:          "William J. Deninger" <deninger@uiuc.edu>
> To:            <roottalk@hpsalo.cern.ch>
> Subject:       Forcing repaints
> Date:          Sat, 6 Dec 1997 11:54:28 -0600

> Hello again,
> 
> How am I able to force a repaint of a canvas, pad or view inside of
> a routine.  My experience is that ROOT doesn't actually update these
> until CInt has free time. 

 Actually TPad::Update() method does force this painting.
 It is called by ROOT itself just CINT has finished the next 
command line from the keyboard. (Calling macros must be regarded as a 
one single command line this way). This means each "End-of-keyboard-command-line"
is replaced by ROOT with a couple of the statements 

   gPad->Modified();
   gPad->Update();


  One can call this TPad::Update() himself as well (see 
tutorials/canvas.C)

  So for your TEST you should replace

   c1->Draw();

 with

   c1->Modified();
   c1->Update();

   Hope this helps
                    Valery
========================

> 
//  TEST ROUTINE
{
// make canvas
 TCanvas *c1 = new TCanvas("c1","Positron tracks");
 c1->cd();

// create TGeometry and builds nodes, etc..
Geometry *geom = new Geometry("g2trace","g2trace"); // builds TGeometry called g2trace


// Prepare data tape and data reconstruction class
BOOK b;

b.Unidaq("1125.tap");

// track level class.  Contains straw chamber info and track reconstruction
HIT *hit;

//________________________________________________

geom->Draw();  // this doens't draw until TEST is finished!? //   !

 // Yes because Draw doesn't "paint". Draw() method just includes the pointer to 
 //                                   geom into the current pad (gPad) drawing TList 
 
===>>  This is useless c1->Draw();      //  What is the appropriate way of accomplishing this?
//  Must be :
   c1->Modified();
   c1->Update();
//________________________________________________


// begining data anlysis loop
//
// retrieve record
while(hit = b.get_event())
   {
   printf("Calculating next track\n");
   hit->Minuit();  // minimize chi2 for track
   TPolyLine3D *poly = new TPolyLine3D(900, hit->xpos, hit->ypos,hit->zpos);

//________________________________________________
   poly->Draw(); // again, this isn't drawn until TEST finishes //    !
// Again that just includes the pointer "poly" into the current pad drawing list

==> Again it is useless.    c1->Draw();  //  What is the appropriate way of accomplishing this?

//  Must be :
   c1->Modified();
   c1->Update();
//________________________________________________
   }
}

Dr. Valeri Faine (Valery Fine)
    ------------ -------------   Phone: +41 22 767 4921
CERN                             FAX  : +41 22 767 7155
CH-1211 Geneva, 23               mailto:fine@mail.cern.ch 
Switzerland                      http://nicewww.cern.ch/~fine
                                 



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:22 MET