Re: Canvas pointers

Rene Brun (Rene.Brun@cern.ch)
Wed, 16 Dec 1998 09:45:18 +0100


ryan roth wrote:
>
> Hello all:
>
> Sorry about the previous message -- I had meant to cancel it and ended up
> sending it instead.
>
> My question was:
>
> If, within a program, I create a TCanvas object and retain a pointer to
> it, and then the user closes canvas window, what is the best way for the
> program to examine the pointer and find out that the canvas has been closed?
>

You can look for a canvas by its name in the list of canvases.

TCanvas *myCanvas =
(TCanvas*)gROOT->GetListOfCanvases()->FindObject("myCanvas");

if (myCanvas == 0) your canvas has been deleted.

Note that this technique can be applied to all named objects
for which gROOT has the corresponding container (see class TROOT).

Rene Brun