-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathTextEntryDialogMultiline.cpp
More file actions
26 lines (22 loc) · 931 Bytes
/
TextEntryDialogMultiline.cpp
File metadata and controls
26 lines (22 loc) · 931 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
#include <wx/wx.h>
#include <wx/textdlg.h>
namespace TextEntryDialogMultilineExample {
class Frame : public wxFrame {
public:
Frame() : wxFrame(nullptr, wxID_ANY, "TextEntryDialog multiline example") {
button->Bind(wxEVT_BUTTON, [&](wxCommandEvent& event) {
wxTextEntryDialog textEntryDialog(this, "Message text", "Caption text", label->GetLabel(), wxTextEntryDialogStyle|wxTE_MULTILINE);
if (textEntryDialog.ShowModal() == wxID_OK)
label->SetLabel(textEntryDialog.GetValue());
});
}
private:
wxPanel* panel = new wxPanel {this};
wxButton* button = new wxButton(panel, wxID_ANY, "Text...", {10, 10});
wxStaticText* label = new wxStaticText(panel, wxID_ANY, "line 1\nline 2", {10, 50});
};
class Application : public wxApp {
auto OnInit() -> bool override {return (new Frame)->Show();}
};
}
wxIMPLEMENT_APP(TextEntryDialogMultilineExample::Application);