Re: [ROOT] TCanvas from TFile to TRootEmbeddedCanvas

From: Thomas Bretz (tbretz@astro.uni-wuerzburg.de)
Date: Thu Jun 05 2003 - 14:21:13 MEST


Hi,

maybe not a solution, but a workaround: Here it is:
void MStatusDisplay::DrawClonePad(TCanvas &newc, const TCanvas &oldc) const
{
     //copy pad attributes
     newc.Range(oldc.GetX1(),oldc.GetY1(),oldc.GetX2(),oldc.GetY2());
     newc.SetTickx(oldc.GetTickx());
     newc.SetTicky(oldc.GetTicky());
     newc.SetGridx(oldc.GetGridx());
     newc.SetGridy(oldc.GetGridy());
     newc.SetLogx(oldc.GetLogx());
     newc.SetLogy(oldc.GetLogy());
     newc.SetLogz(oldc.GetLogz());
     newc.SetBorderSize(oldc.GetBorderSize());
     newc.SetBorderMode(oldc.GetBorderMode());
     ((TAttLine&)oldc).Copy((TAttLine&)newc);
     ((TAttFill&)oldc).Copy((TAttFill&)newc);
     ((TAttPad&)oldc).Copy((TAttPad&)newc);

     //copy primitives
     TObject *obj;
     TIter next(oldc.GetListOfPrimitives());
     while ((obj=next())) {
         gROOT->SetSelectedPad(&newc);
         newc.GetListOfPrimitives()->Add(obj->Clone(),obj->GetDrawOption());
     }
     newc.Modified();
     newc.Update();
}

After reading oldc from the TFile everything is copied to the new canvas 
from the embedded one. I'm not sure if something is missing. The code is 
more or less taken from TCanvas.cxx.

Regards,
Thomas.

H.-Gerd Rosarius wrote:
> Hej Thomas,
> 
> in fact I am faced with the same problem you already had in April. 
> (See here: http://root.cern.ch/root/roottalk/roottalk03/2097.html)
> 
> Did you find a solution? If so, would you be so kind and share it
> with the mailing-list?
> 
> Thanks a lot!
> 
>   H.-Gerd Rosarius
> 
> 



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:12 MET