Draw/paint confusion


I wrote a class derived from TObject and compiled it as a shared library. The class contains two arrays (x and y) that I would like to plot as a TGraph by clicking on the object in a TBrowser. I looked at the TLine example but I cannot figure what will actually draw the TGraph on a mouse double-click in TBrowser and what is the correct sequence of commands to use in the Draw, Paint and/or Browse methods of my class. Where should I call

TGraph *graph=new TGraph(n,x,y);

and how can I display it in a canvas?

Thank you


Simply implement the Browse and Paint functions in your class, ie:

[code]void Myclass::Browse(TBrowser *b)
if (!fGraph) {
fGraph = new TGraph(fN,fX,fY) ; //your arrays in the class

void Myclass::Paint(Option_t *option)



with this implementation, the Browse function is called when I double-click the MyClass object and the TGraph is created correctly (the data are fine) but the Paint function is never called. A blank canvas “c1” appears but not TGraph in sight. What am I missing?