-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathTextEntryDialogPassword.cpp
More file actions
26 lines (22 loc) · 935 Bytes
/
TextEntryDialogPassword.cpp
File metadata and controls
26 lines (22 loc) · 935 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 TextEntryDialogPasswordExample {
class Frame : public wxFrame {
public:
Frame() : wxFrame(nullptr, wxID_ANY, "TextEntryDialog as password example") {
button->Bind(wxEVT_BUTTON, [&](wxCommandEvent& event) {
wxTextEntryDialog textEntryDialog(this, "user: admin", "User password", label->GetLabel(), wxTextEntryDialogStyle|wxTE_PASSWORD);
if (textEntryDialog.ShowModal() == wxID_OK)
label->SetLabel(textEntryDialog.GetValue());
});
}
private:
wxPanel* panel = new wxPanel {this};
wxButton* button = new wxButton(panel, wxID_ANY, "Password...", {10, 10});
wxStaticText* label = new wxStaticText(panel, wxID_ANY, "sysad47@74dasys", {10, 50});
};
class Application : public wxApp {
auto OnInit() -> bool override {return (new Frame)->Show();}
};
}
wxIMPLEMENT_APP(TextEntryDialogPasswordExample::Application);