Re: Motif application

Fons Rademakers (Fons.Rademakers@cern.ch)
Thu, 17 Jul 1997 18:55:13 +0200


Hi Luca,

classes starting with TMotif... are so called peer classes (to use
Java
jargon). They should not be used standalone, they are used by classes
without TMotif, Example: TBrowser uses TMotifBrowser or TWin32BrowserImp
depending on which TGuiFactory class is active (either TMotifGuiFactory
or TWin32GuiFactory). The same for TMotifApplication, use TApplication.

For an example of how to use TApplication see the program
$ROOTSYS/hworld.cxx. Just create a TBrowser object and enter the
eventloop (Run()) and you can interact with the browser. And the
nice thing is, it works also on Windoze.....

Seek_t is a typedef, see the $ROOTSYS/include/Rtypes.h file (or the
doc on the web).

Concerning the directory problem see corrections below.

Cheers, Fons.

PS: your mail address shows incorrectly: agora.smt.it.cern.ch

Luca Sfarzo wrote:
>
> Hello,
>
> I'm trying to realize a stand-alone application using Root and Motif,
> I have some questions:
>
> 1) Can you let me see a simple example on how to open the TMotifBrowser
> in a stand-alone application?
>
> 2) How to manage the TMotifApplication?, is it the corresponding class
> of TApllication under a Motif enviroment?
>
> 3) Where I can learn something about the Seek_t objects?
>
> 4) Last (but not least!): I'm learning how to write an app. to browse in
> a Root file (a simple stand-alone text browser) but I'm having some
> troubles with the cd() method to change a directory in a file.
> I've got a file (test_subdir.root) convertd via h2root.
> The file is divided in various sub-directory two main directory and so
> on...) and I have not been able to set a subdir like the current dir to
> read the histos it contains in order to display it; the following code
> seems not to work well:
> 1.{
> 2.gROOT->Reset();
> 3. TFile f("("~/root/histos/test_subdir.root");
> 4. f.cd("/BARREL/ADC/PHI1_4_A");
> 5. f.ls();

-- this lists contents of f, which are only two directories
-- after the f.cd(xxxxx) the current directory is set to
-- the new path. Use from then on gDirectory. For example:
-- gDirectory->ls() will show you the correct contents.

> 6. TIter next(f.GetListOfKeys());

-- Use: TIter next(gDirectory->GetListOfKeys());

>
> and so on..
> The output of f.ls() is:
>
> TFile** /users/sfarzo/root/histos/test_subdir.root
> TFile* /users/sfarzo/root/histos/test_subdir.root
> TDirectory* BARREL BARREL
> TDirectory* ADC ADC
> KEY: TDirectory PHI1_4_A;1 PHI1_4_A
> KEY: TDirectory PHI1_4_B;1 PHI1_4_B
> KEY: TDirectory ADC;1 ADC
> KEY: TDirectory TDC;1 TDC
> TDirectory* BARREL BARREL
> TDirectory* ADC ADC
> TDirectory* PHI1_4_A PHI1_4_A
> KEY: TH1F h1001;1 PHI 1 PL 1 A
> KEY: TH1F h1002;1 PHI 1 PL 2 A
> .............................................
> KEY: TH1F h1020;1 PHI 4 PL 5 A
> KEY: TDirectory PHI1_4_A;1 PHI1_4_A
> KEY: TDirectory PHI1_4_B;1 PHI1_4_B
> KEY: TDirectory ADC;1 ADC
> KEY: TDirectory TDC;1 TDC
> KEY: TDirectory BARREL;1 BARREL
> KEY: TDirectory ENDCAP;1 ENDCAP
> but when i iterate in the list I discover that the only two objects in
> it are TDirectory BARREL and TDirectory ENDCAP.
> So, how can I set like the current TDirectory i.e. PHI1_4_A to read the
> histos in it?
>
> Many thanks, Luca Sfarzo

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland          Phone: +41 22 7679248
E-Mail: Fons.Rademakers@cern.ch              Fax:   +41 22 7677910