Re: [ROOT] How to make a directory show up in a TBrowser

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed May 08 2002 - 22:55:09 MEST


Hi Conrad,

TFile (and derived) classes are visible directly in TBrowser because
the TFile constructor register them to gROOT->GetListOfFiles() which is
itself added to the list of Root browsables in the TROOT constructor.

If you instantiate a class deriving from TDirectory, it will not be
visible in the left pane of the browser automatically. You can do:
  MyDir *dir= new Mydir;
  gROOT->GetListOfBrowsables()->Add(dir,"some text");

or in your MyDir constructor, add the line
  gROOT->GetListOfBrowsables()->Add(this,GetName());

You can also implement MyDir::Browse if you are not happy
with the behaviour of TDirectory::Browse.

Rene Brun

On 8 May 2002, Conrad Steenberg wrote:

> Hi
> 
> In a similar vein to having a class derived from TFile show up in a
> TBrowser window (like e.g. a TWebFile does) would deriving a class from
> TDirectory make it show up in a TBrowser?
> 
> This is so that a user can browse a non-traditional directory, which
> e.g. is a directory on an ftp or web server.
> 
> Thanks!
> 
> Conrad
> 
> -- 
> *-----------------------------------------*
> | Conrad Steenberg                        |
> | Caltech, Mail Code 356-48               |
> | Pasadena, CA, 91125                     |
> | e-mail: conrad@hep.caltech.edu          |
> | Tel: (626) 395-8758                     |
> *-----------------------------------------*
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:52 MET