X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c8c0e54c700b29c0ec0d073e536f5b2604e3778d..9841339c74917270e36def49a00a0415efe3683e:/src/generic/filedlgg.cpp?ds=inline diff --git a/src/generic/filedlgg.cpp b/src/generic/filedlgg.cpp index cce6ea3eb7..fb4ea8ab41 100644 --- a/src/generic/filedlgg.cpp +++ b/src/generic/filedlgg.cpp @@ -700,11 +700,9 @@ void wxFileDialog::OnChoice( wxCommandEvent &event ) m_list->SetWild( *str ); } -void wxFileDialog::OnActivated( wxListEvent &WXUNUSED(event) ) +void wxFileDialog::OnActivated( wxListEvent &event ) { - wxCommandEvent cevent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK); - cevent.SetEventObject( this ); - GetEventHandler()->ProcessEvent( cevent ); + HandleAction( event.m_item.m_text ); } void wxFileDialog::OnTextEnter( wxCommandEvent &WXUNUSED(event) ) @@ -716,13 +714,23 @@ void wxFileDialog::OnTextEnter( wxCommandEvent &WXUNUSED(event) ) void wxFileDialog::OnSelected( wxListEvent &event ) { - if (FindFocus() == m_list) - m_text->SetValue( event.m_item.m_text ); + if (FindFocus() != m_list) return; + + wxString filename( event.m_item.m_text ); + if (filename == _T("..")) return; + + wxString dir; + m_list->GetDir( dir ); + if (dir != _T("/")) dir += _T("/"); + dir += filename; + if (wxDirExists(dir)) return; + + m_text->SetValue( filename ); } -void wxFileDialog::OnListOk( wxCommandEvent &event ) +void wxFileDialog::HandleAction( const wxString &fn ) { - wxString filename( m_text->GetValue() ); + wxString filename( fn ); wxString dir; m_list->GetDir( dir ); if (filename.IsEmpty()) return; @@ -777,10 +785,6 @@ void wxFileDialog::OnListOk( wxCommandEvent &event ) if (wxDirExists(filename)) { m_list->GoToDir( filename ); - if (filename == _T("/")) - m_text->SetValue( _T("") ); - else - m_text->SetValue( _T("..") ); m_list->GetDir( dir ); m_static->SetLabel( dir ); return; @@ -808,7 +812,14 @@ void wxFileDialog::OnListOk( wxCommandEvent &event ) } SetPath( filename ); - event.Skip(); + + wxCommandEvent event; + wxDialog::OnOK(event); +} + +void wxFileDialog::OnListOk( wxCommandEvent &WXUNUSED(event) ) +{ + HandleAction( m_text->GetValue() ); } void wxFileDialog::OnList( wxCommandEvent &WXUNUSED(event) ) @@ -870,7 +881,7 @@ wxString wxFileSelectorEx(const wxChar *message, const wxChar *default_path, const wxChar *default_filename, - int *indexDefaultExtension, + int *WXUNUSED(indexDefaultExtension), const wxChar *wildcard, int flags, wxWindow *parent,