wx-3.3.0 - Ubuntu 24.04.2 - wxFilePickerCtrl
Black Jack <[email protected]> Sun, 22 Jun 2025 21:40:38 +0300
| Newsgroups | gmane.comp.lib.wxwindows.general |
|---|---|
| Message-ID | <CA+jJYanbzX_ozZk7XLmtVHWLv5C8v=_w55=shZs340EFjAzNUA@mail.gmail.com> |
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?
--
Please read https://www.wxwidgets.org/support/mlhowto.htm before posting.
---
You received this message because you are subscribed to the Google Groups "wx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/wx-users/CA%2BjJYanbzX_ozZk7XLmtVHWLv5C8v%3D_w55%3DshZs340EFjAzNUA%40mail.gmail.com.