Re: [ROOT] draw a TCanvas in a TCanvas

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Apr 22 2004 - 21:49:19 MEST


Hi Thomas,

You must draw the source canvas, eg:

void dclone() {
TFile *f = new TFile("c1.root");
TCanvas *c = gFile->Get("c1");
c1->Draw();
TCanvas *myCanvas = new TCanvas();
myCanvas->Divide(2,3);
myCanvas->cd(1);
gROOT->SetSelectedPad(c); 
c->DrawClonePad();
delete c;
}

Rene Brun

On Thu, 22 Apr 2004, Thomas Eberl 
wrote:

> Hello,
> 
> why does the following NOT draw the TCanvas from the file on the subpad 
> of myCanvas ?
> (using ROOT 3.03.09)
> void draw()
> {
> TCanvas myCanvas();
> myCanvas.Divide(2,3);
> TCanvas *c = gFile->Get("CanvasOnFile");
> myCanvas.cd(1);
> //gROOT->SetSelectedPad(gPad); <-- I also tried this
> c->DrawClonePad()
> // ??? A new window opens up, c is drawn in the new window :-( ???
> }
> 
> Thanks for a hint how to do it in a macro, using the mouse and "middle 
> button" selection works fine.
> 
> 
> Thomas
> 



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:07 MET