[ROOT] Subclassing TPad.

From: Brett Viren (bv@bnl.gov)
Date: Mon Feb 26 2001 - 21:08:19 MET


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)
{
    this->Range(6.0,12.0,14.0,28.0);
    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();
    c.Update();
    app.Run();
    return 0;
} // end of main()



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:38 MET