From ba34f22f9ca604cadf8a7fd88af0f22e52ef58e9 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Fri, 12 Jun 2020 19:07:29 -0400 Subject: [PATCH] button input --- gui/wxmain.hpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/gui/wxmain.hpp b/gui/wxmain.hpp index b5122f6..793fbc1 100644 --- a/gui/wxmain.hpp +++ b/gui/wxmain.hpp @@ -1,15 +1,29 @@ #ifndef WXMAIN_HPP_ #define WXMAIN_HPP_ +#include #include #include class MainFrame : public wxFrame { + enum Id { + Welcome = 1, + Single + }; + public: MainFrame() : wxFrame(nullptr, -1, "Hello world", wxPoint(50, 50), wxSize(640, 480)) { - auto lTitle = new wxStaticText(this, wxID_ANY, "Welcome to the GUI."); + new wxStaticText(this, Id::Welcome, "Welcome to the GUI.", wxPoint(20, 20)); + new wxButton(this, Id::Single, "Single", wxPoint(20, 60)); + + Bind(wxEVT_BUTTON, &MainFrame::onSinglePressed, this, Id::Single); + } + + void onSinglePressed(wxCommandEvent& ce) { + auto button = dynamic_cast(ce.GetEventObject()); + button->SetLabel("Nice"); } };