Re: [ROOT] Unwanted TRootBrowser

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Sun Mar 17 2002 - 01:48:27 MET


Hi Simon,

  currently what you want is a bit tricky to do due to the fact that the
methods in TRootGuiFactory are not virtual. So what you need to do:

- derive from TGuiFactory a class TMyGuiFactory.
- copy complete contents from TRootGuiFactory to TMyGuiFactory.
- change CreateBrowserImp to create your TMyRootBrowser instead of a
  TRootBrowser.
- in your application before creating any browser call:
   gGuiFactory = (TGuiFactory *) gROOT->ProcessLineFast("new
                                       TMyGuiFactory();");

That should do it.

I've made the methods in TRootGuiFactory virtual in the dev version in
cvs, this will allow you to derive your TMyGuiFactory directly from
TRootGuiFactory and allows you to override the CreateBrowserImp methods.
For the rest you need to do the same to activate your TMyGuiFactory.

Cheers, Fons.




On Sun, 2002-03-17 at 00:57, Simon Dean wrote:
> Well, I'm not sure I understand it myself. I have basically attempted to
> start modifying the TRootBrowser code to suit my own needs. TRootBrowser
> accepts a TBrowser as input and within the ROOT code, this is a pure
> TBrowser. However, in my case the TBrowser is already supplied as a
> TRootBrowser so my program produces a modified TRootBrowser based on
> another TRootBrowser! 
> 
> cheers,
> 
> Simon
> 
> On Sat, 16 Mar 2002, Valeri Fine wrote:
> 
> > The implementation of TBrowserImp is provided but TGuiFactory class.
> > This means to get his own TBrowserImp one has to provide the custom
> > version of  TGuiFactory. So far so good. Alas the name of the share libary
> > with the "custom" version of TGuiFactory class implementation is hardcoded
> > by TApplication class
> > 
> > See:
> > http://root.cern.ch/root/htmldoc/src/TApplication.cxx.html#TApplication:Load
> > GraphicsLibs
> > 
> > It  sounds it is not trivial  to do what you want.
> > (May be Fons will correct me). By the way I can image why you did
> > get TRootBrowser but how did you manange to get your browser as well ?
> > 
> >         Cheers, Valeri
> > 
> > 
> > ----- Original Message -----
> > From: "Simon Dean" <sdean@hep.man.ac.uk>
> > To: <roottalk@pcroot.cern.ch>
> > Sent: Saturday, March 16, 2002 6:09 PM
> > Subject: [ROOT] Unwanted TRootBrowser
> > 
> > 
> > > Hi there,
> > >
> > > I'm trying to code a class which inherits from TBrowserImp. The problem is
> > > that whenever I initialise a TBrowser to pass into my class, the system
> > > decides for me that I actually want a TRootBrowser. This is quite annoying
> > > and I end up with two GUIs on screen neither of which is what I want.
> > >
> > > How can I get round this?
> > >
> > > cheers,
> > >
> > > Simon
> > >
> > 
-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7679480



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