-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathDirPickerCtrl.cpp
More file actions
27 lines (23 loc) · 904 Bytes
/
DirPickerCtrl.cpp
File metadata and controls
27 lines (23 loc) · 904 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <wx/app.h>
#include <wx/filepicker.h>
#include <wx/frame.h>
#include <wx/panel.h>
#include <wx/stattext.h>
namespace DirPickerCtrlExample {
class Frame : public wxFrame {
public:
Frame() : wxFrame {nullptr, wxID_ANY, "DirPickerCtrl example"} {
picker->Bind(wxEVT_DIRPICKER_CHANGED, [&](wxFileDirPickerEvent& event) {
label->SetLabel(wxString::Format("Path = %s", event.GetPath()));
});
}
private:
wxPanel* panel = new wxPanel {this};
wxStaticText* label = new wxStaticText {panel, wxID_ANY, "Path = ", wxPoint(10, 50)};
wxDirPickerCtrl* picker = new wxDirPickerCtrl {panel, wxID_ANY, wxEmptyString, wxEmptyString, {10, 10}, wxDefaultSize, wxDIRP_DEFAULT_STYLE|wxDIRP_SMALL};
};
class Application : public wxApp {
auto OnInit() -> bool override {return (new Frame)->Show();}
};
}
wxIMPLEMENT_APP(DirPickerCtrlExample::Application);