flags, wxPoint(x, y));
if( wxStrlen(defaultExtension) != 0 )
{
- int filterFind = 1,
+ int filterFind = 0,
filterIndex = 0;
for( unsigned int i = 0; i < filter2.Len(); i++ )
{
// save the start index of the new filter
unsigned int is = i++;
- filterIndex++;
// find the end of the filter
for( ; i < filter2.Len(); i++ )
if( i-is-1 > 0 && is+1 < filter2.Len() )
{
if( filter2.Mid(is+1,i-is-1).Contains(defaultExtension) )
-// if( filter2.Mid(is+1,i-is-1) == defaultExtension )
{
filterFind = filterIndex;
break;
}
}
+
+ filterIndex++;
}
}
fileDialog.SetFilterIndex(filterFind);
}
+ wxString filename;
if ( fileDialog.ShowModal() == wxID_OK )
{
- wxStrcpy(wxBuffer, (const wxChar *)fileDialog.GetPath());
- return wxBuffer;
+ filename = fileDialog.GetPath();
}
- else
- return wxGetEmptyString();
+
+ return filename;
}
int y)
{
- wxFileDialog fileDialog(parent, title ? title : wxT(""), defaultDir ? defaultDir : wxT(""),
- defaultFileName ? defaultFileName : wxT(""), filter ? filter : wxT(""), flags, wxPoint(x, y));
+ wxFileDialog fileDialog(parent,
+ title ? title : wxT(""),
+ defaultDir ? defaultDir : wxT(""),
+ defaultFileName ? defaultFileName : wxT(""),
+ filter ? filter : wxT(""),
+ flags, wxPoint(x, y));
+ wxString filename;
if ( fileDialog.ShowModal() == wxID_OK )
{
- *defaultFilterIndex = fileDialog.GetFilterIndex();
- wxStrcpy(wxBuffer, (const wxChar *)fileDialog.GetPath());
- return wxBuffer;
+ if ( defaultFilterIndex )
+ *defaultFilterIndex = fileDialog.GetFilterIndex();
+
+ filename = fileDialog.GetPath();
}
- else
- return wxGetEmptyString();
+
+ return filename;
}
wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
OFN_EXPLORER |
#endif // OFN_EXPLORER
OFN_ALLOWMULTISELECT;
+ if ( !(m_dialogStyle & wxCHANGE_DIR) )
+ msw_flags |= OFN_NOCHANGEDIR;
OPENFILENAME of;
wxZeroMemory(of);
//== Execute FileDialog >>=================================================
- bool success = (m_dialogStyle & wxSAVE) ? (GetSaveFileName(&of) != 0)
- : (GetOpenFileName(&of) != 0);
+ bool success = (m_dialogStyle & wxSAVE ? GetSaveFileName(&of)
+ : GetOpenFileName(&of)) != 0;
DWORD errCode = CommDlgExtendedError();