Re: Crash in TBrowser when inspecting converted HBOOK ntuple

From: Valery Fine (fine@mail.cern.ch)
Date: Tue Oct 21 1997 - 11:35:36 MEST


On 21 Oct 97 at 0:54, Gordon Watts (Brown Universit wrote:

> Sorry. It was quite late. The "plus sign" is on the left hand side;
> there are, of course, none on the right hand side. If you compare
> behaviors on the NT Explorer and the root one there are a few
> differences:
> 

  First of all did you observer the same problem under UNIX ROOT 
browser.

> 
> 1) In NT: When a folder icon on the left had side changes from a
> close folder to an open folder, its contents are always displayed on
> the right hand side of the window. In ROOT this isn't the case.
> 
> 2) In NT clicking on the plus object on the left hand side of the
> display does not open the folder (or change its icon). In ROOT the
> folder icon is changed to an open (even though its contents are not
> displayed on the left hand side).
> 


> >   Clicking the "folder" icon on the "right hand" panel does explore 
> >this folder and does change its icon on the "left hand" panel from 
> >"close" to "open" state too.
> >   Double clicking the  the "close" folder marked with "+" on the 
> >"left hand" panel does change its state from "close" to "open" and 
> >present its contents with "right hand" one as well.
> >
> 
> These are both minor points -- neither of which are crashers or that
> have no workarounds. A good GUI is a very difficult thing to design
> (look how many years it took Apple & MS to get it right... if you
> call the current stuff "right".).
> 
   I've tried to reproduce your problem and I think I've understood
the troubles you met.

  Well there are alot of things to do with the ROOT browser but the
main reason of the differences you are talking about  not just wrong
behaviour of the NT Explorer against of the ROOT Browser. The reason
is the NATURE of the OBJECT these browsers present (For NT Explorer
it is usally the objects of the file system, namely "directories" 
and "files"

  Let me explain a little bit how the ROOT (NT) Browser works. It does
NO miracles. It does VERY simple thing, namely::

  Here is the FULL text:

//______________________________________________________________________________
void TWin32BrowserImp::Add(TObject *obj, const char *name)
{
 const char *n = name;
 if (!n) n = obj->GetName();
 if (obj->IsFolder()) AddToList(obj,n);

 if (fListBlocked) return;

 if (fTreeListFlag & kListViewOnly)
     { TWin32CommCtrl *ctrl = GetCommCtrl(kID_LISTVIEW);
       if (ctrl)
           ctrl->Add(obj,n);
     }
}
//______________________________________________________________________________
void TWin32BrowserImp::AddToList(TObject *obj, const char *name)
{

   if (fTreeListFlag & kTreeOnly)
       {
          TWin32CommCtrl *ctrl = GetCommCtrl(kID_TREEVIEW);
          if (ctrl)
               ctrl->Add(obj,name);
       }

}



  It presents object with the "close folder icon" if the 
TObject::IsFolder() method of the class returns "kTRUE" value. 
Othewise ittreats the object as a simnple document for the "right 
panle" only.

 Clicking on this folder with the left button of the 
mouse calls the TObject::Browse() method of the selected object and 
does change that icon from the "close" to "open" state 

                but that's ALL. 

The TObject::Browse method implementation (user-written, not ROOT in 
general) of the selected class is responsible to present object on 
the browser panels. To present itself on some panel TBroswer::Add() 
or TBrowser::AddToList() method should be called some where (usually 
by thge Browse method) If it fails to do so (or just it does nothing) 
- that nothing happens on the both panels, but the left icon will be 
not changed as well and will  keep still "wearing" the "open folder" 
icon.   If one observes the "open" folder icon on the "left_side" but 
sees no change on the "right" this means the TObject::Browse method 
of that object does just an empty thing..

at present it looks as follows:

//___________________________________________________________________
void TObject::Browse(TBrowser *b)
{
   // Browse abstract method. Must be overridden if a class wants to be browsed.

   AbstractMethod("Browse");
}


  Hmm! Well, just an idea probably ROOT should clean that "right"
panel first than call "TObject::Browse()" method. May be that's all 
one needs to implement. But I think it would be better to change the 
"default" behaviour of the TObject class object not TBrowser itself.

  Even more by default TObject::Browse() may call TObject::Inspect() 
rather then cleaning the right panel. 

I mean if the text above would be done as :
(Anyway I think TBrowser should erase the right-panel and then 
 call TObject::Browse() ??? ).

//__________________________
void TObject::Browse(TBrowser *b)
{
   // Browse abstract method. Must be overridden if a class wants to be browsed.

   if (b) b->Add(this);
   // AbstractMethod("Browse");
}

 or

//__________________________
void TObject::Browse(TBrowser *b)
{
   // Browse abstract method. Must be overridden if a class wants to be browsed.

   Inspect();
   // AbstractMethod("Browse");
}


 
  Any other ideas ?



  Likely ROOT team may take this in account.
  Thank you for usefull discussion anyway.

         valery.
Dr. Valeri Faine (Valery Fine)
    ------------ -------------   Phone: +41 22 767 4921
CERN                             FAX  : +41 22 767 7155
CH-1211 Geneva, 23               mailto:fine@mail.cern.ch 
Switzerland                      http://nicewww.cern.ch/~fine
                                 



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:21 MET