allow multiple extensions in tge generic wxFileDialog (patch 457580)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11719 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2001-09-28 14:26:55 +00:00
parent afb74fdd76
commit 551adc4b47
2 changed files with 19 additions and 13 deletions

View File

@@ -399,9 +399,9 @@ void MyFrame::MultiChoice(wxCommandEvent& WXUNUSED(event) )
void MyFrame::FileOpen(wxCommandEvent& WXUNUSED(event) ) void MyFrame::FileOpen(wxCommandEvent& WXUNUSED(event) )
{ {
// wxFAIL_MSG( "Test assert" ); wxFileDialog dialog(this, "Testing open file dialog",
"", "",
wxFileDialog dialog(this, "Testing open file dialog", "", "", "*.txt", 0); "C++ files (*.h;*.cpp)|*.h;*.cpp");
if (dialog.ShowModal() == wxID_OK) if (dialog.ShowModal() == wxID_OK)
{ {

View File

@@ -655,19 +655,25 @@ void wxFileCtrl::Update()
f = wxFindNextFile(); f = wxFindNextFile();
} }
res = m_dirName + wxT("/") + m_wild; // Tokenize the wildcard string, so we can handle more than 1
f = wxFindFirstFile( res.GetData(), wxFILE ); // search pattern in a wildcard.
while (!f.IsEmpty()) wxStringTokenizer tokenWild( m_wild, ";" );
while ( tokenWild.HasMoreTokens() )
{ {
res = wxFileNameFromPath( f ); res = m_dirName + wxT("/") + tokenWild.GetNextToken();
fd = new wxFileData( res, f ); f = wxFindFirstFile( res.GetData(), wxFILE );
wxString s = fd->GetName(); while (!f.IsEmpty())
if (m_showHidden || (s[0u] != wxT('.')))
{ {
Add( fd, item ); res = wxFileNameFromPath( f );
item.m_itemId++; fd = new wxFileData( res, f );
wxString s = fd->GetName();
if (m_showHidden || (s[0u] != wxT('.')))
{
Add( fd, item );
item.m_itemId++;
}
f = wxFindNextFile();
} }
f = wxFindNextFile();
} }
SortItems( ListCompare, 0 ); SortItems( ListCompare, 0 );