Hi Munir, I do not understand what is your point? At your second level, you can check if a file is already connected with a statement like: TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("filename"); if (file) { // file already connected } else { // file not yet connected // open file file = new TFile("filename"); } Rene Brun Munir uzzaman wrote: > > hi rooters! > > i am using root gui to display events in PHENIX TEC. I am fatching a > problem regarding files to keep in memory. I have three layers in the gui. > I open a file in the top level. then i click on the second layer enable > button. it works fine until i close the second layer. then if i want to > run another disply in the second layer, i need to open the file again in > the top layer. but it is troublesome and not a very good option. I was > wondering if i am missing something. let me give the part of the macro: > > ******************************************** > file open in the top layer: > > case M_EVENT_FILE_OPEN: > { > gSystem->WorkingDirectory(); > gSystem->ChangeDirectory("/export/bigdisk/dcm_data/rc"); > new TGFileDialog(fClient->GetRoot(), this, kFDOpen,fEventFileInfo); > gSystem->WorkingDirectory(); > gSystem->ChangeDirectory("/home/phnxtec/munir/gui/work"); > if(fEventFileInfo->fFilename&&strlen(fEventFileInfo->fFilename)>2) { > displayMessage(MFMessage,fMessageFrame,"Event File :",fEventFileInfo->fFilename); > if(fEventFileInfo->fFilename) { > if(EventIt) delete EventIt; > Int_t Status; > EventIt=new fileEventiterator(fEventFileInfo->fFilename,Status); > if(Status){ > displayMessage(MFMessage,fMessageFrame,"Event File:",fEventFileInfo->fFilename,"does not exist"); > delete EventIt; > EventIt = NULL; > EventsReadFromFile = 0; > break; > } > } > } else { > displayMessage(MFMessage,fMessageFrame,"EventFile not yet opened "); > return kFALSE; > } > } > break; > ********************************************* > > in the second layer (which is called TecGlobal.cxx) > ------------------------------ > void TecGlobal::CloseWindow() > { > TecDialog->setGlobalClosed(GlobalID); // default is NULL > TecDialog ->removeFromGlobalBooked(this); > delete this; > } > ----------------------------- > case M_GLOBAL_CLOSE: > printf("\nTerminating dialog: %s pressed\n", > (parm1 == 1) ? "OK" : "Cancel"); > CloseWindow(); > break; > default: > break; > ---------------------------- > > your response will be truely appreciated. > > -munir > > ------------------------------------------------------------------------------ > MUNIR uzzaman > ------------------------------------------------------------------------------ > Graduate Student | Brookhaven National Lab |Phone: > Department of Physics | PO Box 686, Upton, NY 11973 |(516)-344-7266 > University of California |-----------------------------|(516)-924-9533(Home) > Riverside, CA 92521 |email: munir@phyun0.ucr.edu | > USA | munir@bnl.gov | > ------------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > MUNIR uzzaman > ------------------------------------------------------------------------------ > Graduate Student | Brookhaven National Lab |Phone: > Department of Physics | PO Box 686, Upton, NY 11973 |(516)-344-7266 > University of California |-----------------------------|(516)-924-9533(Home) > Riverside, CA 92521 |email: munir@phyun0.ucr.edu | > USA | munir@bnl.gov | > ------------------------------------------------------------------------------
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:30 MET