Compare file paths using wxFileName, not wxString, in the sample.
Comparing paths using wxString is a bad idea as identical paths can be seen as mismatching because of case-only differences. Also, don't reset wxRadioBox selection from its selection handler, this doesn't work under e.g. wxGTK and is a bad example. Closes #14791. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72820 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
|
||||
#include "wx/wupdlock.h"
|
||||
#include "wx/stdpaths.h"
|
||||
#include "wx/filename.h"
|
||||
|
||||
#include "widgets.h"
|
||||
|
||||
@@ -349,10 +350,13 @@ void DirCtrlWidgetsPage::OnRadioBox(wxCommandEvent& WXUNUSED(event))
|
||||
}
|
||||
|
||||
m_dirCtrl->SetPath(path);
|
||||
if(!m_dirCtrl->GetPath().IsSameAs(path))
|
||||
|
||||
// Notice that we must use wxFileName comparison instead of simple wxString
|
||||
// comparison as the paths returned may differ by case only.
|
||||
if ( wxFileName(m_dirCtrl->GetPath()) != path )
|
||||
{
|
||||
wxLogMessage(wxT("Selected standard path and path from control do not match!"));
|
||||
m_radioStdPath->SetSelection(stdPathUnknown);
|
||||
wxLogMessage("Failed to go to \"%s\", the current path is \"%s\".",
|
||||
path, m_dirCtrl->GetPath());
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user