Re: [ROOT] TGFileDilog error

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Tue Jun 18 2002 - 19:57:22 MEST


Hi Ernesto,

 mod now in CVS. Thanks.

Cheers, Fons.



On Sat, 2002-06-15 at 10:58, Ernesto Lopez wrote:
> Hi rooters,
> 
> I found that when create a TGFileDialog and you click over a directory and
> then click the open buttom there is:
>  *** Break *** segmentation violation
> instead of open the directory as the case of a double click.
> 
> I changed in:
> Bool_t TGFileDialog::ProcessMessage(Long_t msg, Long_t parm1, Long_t)
> the case  kCM_BUTTON and kTE_ENTER by a pice of code from
> kCT_ITEMDBLCLICK and it works OK.
> 
> /////////////////////////////////////
> 
>             case kCM_BUTTON:
> 
>                switch (parm1) {
>                   case kIDF_OK:
>                      // same code as under kTE_ENTER
>                      if (fTbfname->GetTextLength() == 0) {
>                         const char *txt = "Please provide file name or use
> \"Cancel\"";
>                         new TGMsgBox(fClient->GetRoot(), GetMainFrame(),
>                                      "Missing File Name", txt,
> kMBIconExclamation,
>                                      kMBOk);
>                         return kTRUE;
>                      }
> 
> #ifndef WIN32
>                      if (fFc->NumSelected() == 1) {
>                         f = (TGFileItem *) fFc->GetNextSelected(&p);
>                         if (S_ISDIR(f->GetType())) {
> 
> fFc->ChangeDirectory(f->GetItemName()->GetString());
>                            fTreeLB->Update(fFc->GetDirectory());
>                            if (fFileInfo->fIniDir) delete []
> fFileInfo->fIniDir;
>                            fFileInfo->fIniDir =
> StrDup(fFc->GetDirectory());
>                         } else {
>                            fFileInfo->fFilename =
> gSystem->ConcatFileName(fFc->GetDirectory(),
> 
> fTbfname->GetString());
>                            delete this;
>                         }
>                      }
> #else
> #ifdef GDK_WIN32
>                      if (fFc->NumSelected() == 1) {
>                         f = (TGFileItem *) fFc->GetNextSelected(&p);
>                         if ((f->GetType()) & _S_IFDIR) {
> 
> fFc->ChangeDirectory(f->GetItemName()->GetString());
>                            fTreeLB->Update(fFc->GetDirectory());
>                         } else {
>                            fFileInfo->fFilename =
> gSystem->ConcatFileName(fFc->GetDirectory(),
> 
> fTbfname->GetString());
>                            delete this;
>                         }
>                      }
> #endif
> #endif
>                      break;
> 
> ////////////////////////////////////////////////////////////
> 
> intead of:
> 
> ///////////////////////////////////////////////////////////
> 
>             case kTE_ENTER:
>                // same code as under kIDF_OK
>                if (fTbfname->GetTextLength() == 0) {
>                   const char *txt = "Please provide file name or use
> \"Cancel\"";
>                   new TGMsgBox(fClient->GetRoot(), GetMainFrame(),
>                                "Missing File Name", txt,
> kMBIconExclamation,
>                                kMBOk);
>                   return kTRUE;
>                }
>                fFileInfo->fFilename =
> gSystem->ConcatFileName(fFc->GetDirectory(),
> 
> fTbfname->GetString());
>                delete this;
>                break;
> 
> //////////////////////////////////////////////////
> 
> Cheers
>     Ernesto
-- 
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:57 MET