Re: [ROOT] Subclassing TPad.

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Mar 01 2001 - 23:29:53 MET


Hi Brett,
I have introduced the few changes in your code to get it running.

Rene Brun

On Mon, 26 Feb 2001, Brett Viren wrote:

> Hi.
> 
> I want to have a class which inherits from TPad, draws on itself and
> is contained in a canvas.  So far, I can't get any things drawn to
> show up except for the TPad itself.  I'll append some test code
> illustrating the problem.  Can someone hand me a clue?
> 
> Thanks,
> -Brett.
> 
> // drawstuff.cxx - simple ROOT drawing example
> // to compile:
> // g++ -g -Wall -O -o drawstuff drawstuff.cxx `root-config --cflags --glibs`
> //
> #include "TROOT.h"
> #include "TRint.h"
> #include "TCanvas.h"
> #include "TPad.h"
> #include "TEllipse.h"
> 
> class DrawStuff : public TPad
> {
> public:
>     DrawStuff();
> private:
>     TEllipse fEllipse;
> };
> 
> DrawStuff::DrawStuff()
>     : TPad("DrawStuff","Draw Stuff",0.0,0.0,1.0,1.0),
>       fEllipse(10.0,20.0,2.0,4.0)
> {
>     Range(6.0,12.0,14.0,28.0);
>     Draw(); //NEW
      cd();   //NEW
      fEllipse.SetFillColor(6);
>     fEllipse.SetFillStyle(3008);
>     fEllipse.Draw();
> }
> 
> int main (int argc, char *argv[])
> {
>     TROOT blah("blah", "blah");
>     TRint app("blah", &argc, argv, 0, 0);
>     TCanvas c("blah canvas");
>     DrawStuff ds;
>     //ds.Draw(); //COMMENTED
>     c.Update();
>     app.Run();
>     return 0;
> } // end of main()
> 



This archive was generated by hypermail 2b29 : Fri Jun 08 2001 - 11:51:20 MEST