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
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:57 MET