Re: Object lifetime/scope connected to TFile

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Sep 08 1999 - 18:30:13 MEST


Marco,
Invoking TPad::Modified() everytime you touch an object in the pad
is not a bad idea. This is indeed the case with most objects in the Root
libraries. Automatically calling TPad::Update is impossible.
Imagine the case where you draw 10,000 lines in a canvas, you cannot
update the canvas every time you enter a new line or you edit a line.
As you have found, we automatically invoke TCanvas::Update when you type
CR
at the command line. In a macro, it is your responsability to call this
function
at the key points in your macro.

Rene Brun

Marco van Leeuwen wrote:
> 
> Hi,
> 
> I just received an e-mail as an answer to the question below, which made me
> 'investigate' some more.
> 
> >Furthermore, I was wondering about the something associated for drawn
> >objects. I've been rereading the ROOT-documentation ("Overview") and I
> >found the follwing, on page 35 How to Draw Objects:
> >
> >An instruction Object->Draw() in fact does not draw directly. It simply
> >adds a reference (...) This means that if the content of object changes,
> >your picture will change.
> >
> >This is not true, at least not for "stack" based TH1F and TF1. (I didn't
> >check how it exactly works with heap based ones.)
> 
> It turned out that one has to call Modified(1) of the canvas in which the
> Histogram appears. In command-line mode, this result in an automatical
> update of the canvas, since the Update() methods of the canvases are called
> after execution of each line. I can image the want for the Modified flag
> for object which are IN the canvas, but for the canvas itself this seems a
> bit strange, since the call MyCanvas->Modified(1) apparently (ALWAYS) needs
> to proceed a call to MyCanvas->Update(), to force the update of the canvas.
> I don't know about the technicalities, but I would propose to either set
> the Modified flag of a canvas to kTRUE every time something in the canvas
> is modified or to arrange that a call to Update always checks the Modified
> flags of the drawn objects (regardless of the Modified-flag of the canvas).
> 
> Does anyone disagree???
> 
> Ciao,
> 
> Marco van Leeuwen



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