Hi all.
I built 3.3.0 today, and found error or am I wrong....
wxFilePickerCtrl returns empty file path.
Both wxFileName wxFilePickerCtrl::GetFileName()
and wxString wxFilePickerCtrl::GetPath()
Here is minimal demo-app code to reproduce it.
//-------------------------------------------
#include <wx/app.h>
#include <wx/frame.h>
#include <wx/filepicker.h>
#include <wx/filename.h>
#include <wx/textctrl.h>
class MyFrame : public wxFrame
{
wxFilePickerCtrl* m_filePicker;
wxTextCtrl* m_textCtrl1;
wxTextCtrl* m_textCtrl2;
wxTextCtrl* m_textCtrl3;
wxTextCtrl* m_textCtrl4;
public:
MyFrame(wxWindow *parent, int id = wxID_ANY, wxString title = wxT("wx330 FilePicker Error Demo")) : wxFrame(parent, id, title)
{
m_filePicker = new wxFilePickerCtrl( this, wxID_ANY, wxEmptyString, wxT("Select a file"), wxT("*.*"), wxPoint(0,0), wxSize( 200,30 ), wxFLP_OPEN );
m_textCtrl1 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxPoint(0, 50), wxSize(100, 30) );
m_textCtrl2 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxPoint(0, 90), wxSize(100, 30) );
m_textCtrl3 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxPoint(0, 130), wxSize(100, 30) );
m_textCtrl4 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxPoint(0, 170), wxSize(100, 30) );
m_filePicker->Bind( wxEVT_COMMAND_FILEPICKER_CHANGED, &MyFrame::OnFilePickUpChanged, this );
}
void OnFilePickUpChanged( wxFileDirPickerEvent& event )
{
wxFileName fname = m_filePicker->GetFileName();
wxString longPath = fname.GetLongPath();
wxString fullName = fname.GetFullName();
wxString fnamePath = fname.GetPath();
wxString pickerPath = m_filePicker->GetPath();
m_textCtrl1->AppendText(longPath);
m_textCtrl2->AppendText(fullName);
m_textCtrl3->AppendText(fnamePath);
m_textCtrl4->AppendText(pickerPath);
}
~MyFrame(){}
};
class MyApp : public wxApp
{
public:
virtual bool OnInit()
{
MyFrame* frame = new MyFrame(0L);
frame->Show(true);
return true;
}
};
wxIMPLEMENT_APP(MyApp);
//------------------------------------------------------------
Am I doing something wrong or is this really an error?