Ownership of TText, TPaveText, TLine etc by TCanvas?

Hi,

I’d like to be able to call a method from compiled code that creates a TCanvas, draws on it various TGraphs, and then draws labels using TText, TPaveText etc and legends using TLine. Since all these objects have to be created using “new” for persistency, I’d like to be able to make graphics objects like TText, TPaveText and TLine owned by the associated TCanvas, so that when one closes the TCanvas window which deletes the TCanvas, all the associated graphics objects are deleted with it.

Is there a way to do this?

I haven’t been able to find a way of doing this so that I have to do the book-keeping of all the graphics objects created with “new” in order to delete them manually after their associated TCanvas is deleted.

Thanks,
Marios

Simply call

myobject->SetBit(kCanDelete); for all these objects that you want to see deleted when the canvas is cleared.

Rene