Re: [ROOT] TBrowser and TGListTree

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Mon Nov 12 2001 - 18:36:23 MET


Hi Christian,

"cstrato@EUnet.at" wrote:
> 
> In my GUI macro I am trying to implement a TGListTree to
> display the contents of TFiles.
> Although I try to use code from TRootBrowser, I would
> appreciate any hints how this could be done best?
> 
> While studying the code of TRootBrowser I came across
> a couple of questions:
> 
> 1, It seems that TBrowser depends on every object¥s
> function "obj->Browse(fBrowser)". So I would have to
> substitute for this function?
> 
> In the new root version you have as source code:
> TRootBrowser::BrowseObj(TObject *obj)
>    obj->Browse(fBrowser);
> 
> TObject::Browse(TBrowser *b)
>    TClass::AutoBrowse(this,b);
> 
> TClass::AutoBrowse(TObject *obj, TBrowser *b)
>    TAutoInspector insp(b);
>    obj->ShowMembers(insp,cbuf);
> 
> however, TObject has no longer memberfunction ShowMembers().
>
ShowMembers() is defined in ClassDef/ClassImp. Override the
TObject::Browse() method for custom browsing behaviour.

> 
> 2, Mouse events in TGListTree:
> Double clicking on item always emits first Clicked() and then
> DoubleClicked(). Is there a reason for this?
> Is it possible to separate these events, so that I could
> use these functions for different purposes?
>
The reason is that a double click is always first a single click
and that we don't want to build in a "wait" to see if a click
is a single or a double click (which can be only found out after
the double click wait time has expired). Make sure that your
single click can be followed by a double click (like selecting
the object on single click and executing some action on selected
object when double clicked).
> 
> Is it possible to add (event->fYRoot << 16) | event->fXRoot)
> as variable in Clicked() and DoubleClicked()?
> 
Now possible in version in CVS. New methods in TGListView and
TGListTree that emit signal with in addition x, y for the
mouse position at click time.
>
> 3, Scrollbars in TBrowser:
> TRootIconBox in "Details" view: When TBrowser window is reduced
> horizontal scrollbar does only appear when ObjHeader("Name") is
> only partly visible, but not when only ObjHeader("Title") is
> covered. Is this a bug or a feature? How could this be changed
> when I want to create my own descendent of TGFileContainer?
>
This is a feature. You need to override TGLVEntry::GetDefaultSize()
where you modify the case for kLVDetails to include also the length
of the title or the other subnames you want to keep visible.

> 
> 4, Items can be displayed in treeview multiple times:
> Suppose I have a TFile "test.root" containing a folder "test;1"
> in treeview of TBrowser. Clicking on "test.root" puts "test;1"
> also in treeview as "test;1". Clicking on "test;1" converts it
> to "test". Clicking again on "test.root" puts another "test;1"
> in treeview as "test;1", etc, etc. In this way you put the one
> item "test;1" as many times in treeview as you want. Is this
> behaviour intended?
> 
Has still to be optimzed/fixed.

-- Fons


-- 
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 : Tue Jan 01 2002 - 17:51:08 MET