Jan Erik,
You cannot call wp1 directly. You must draw the canvas first.
Rene Brun
Jan Erik Sundermann wrote:
>
> Hi Rene,
>
> I tested your code and it works fine for me. On the other hand, the described
> problem persists when opening and drawing the testcanvas and calling the
> function wp1() directly from the root interpreter.
>
> Best regards,
>
> Jan Erik.
>
> On Monday 12 May 2003 22:11, Rene Brun wrote:
> > Hi Jan Erik,
> >
> > I do not know in which way you call your function.
> > In attachement see a script using your code that produces
> > what you expect.
> >
> > Rene Brun
> >
> > On Mon, 12 May
> > 2003, Jan
> >
> > Erik Sundermann wrote:
> > > Hello,
> > >
> > > I've problems executing the following script:
> > > >-------
> > >
> > > #include "TCanvas.h"
> > > #include "TString.h"
> > >
> > >
> > > void
> > > writePadsToPs(TCanvas* canvas, char* filename, int nbPadLow = 1, int
> > > nbPadHigh = 1) {
> > >
> > > for (int index = nbPadLow; index <= nbPadHigh; index++) {
> > >
> > > canvas->cd(index);
> > > TPad* thispad = (TPad*) gPad;
> > > TCanvas *tempcanvas = new TCanvas();
> > > tempcanvas->cd();
> > > TPad *clonepad = (TPad*) thispad->DrawClone();
> > > clonepad->SetPad(0,0,1,1);
> > > TString tempfilename(filename);
> > > if (index == nbPadLow)
> > > tempfilename += "(";
> > > if (index == nbPadHigh)
> > > tempfilename += ")";
> > > tempcanvas->SaveAs(tempfilename);
> > > delete tempcanvas;
> > >
> > > }
> > > }
> > >
> > > ---------<
> > >
> > > When using the above code on the attached canvas the DrawClone does not
> > > write to the temporary canvas but to the original canvas. The same code
> > > works when executed line by line on the interpreter prompt.
> > >
> > > I'm using root version 3.05/03 on RedHat 7.3.
> > >
> > >
> > > Best regards,
> > >
> > > Jan Erik.
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:11 MET