From 450937a25710b684d81d3a022d67a5171790ffc2 Mon Sep 17 00:00:00 2001 From: daleclack Date: Mon, 17 Oct 2022 23:17:11 +0800 Subject: [PATCH] Improve dialog --- Gtkmm3/gtk141_minesweeper2/src/InputBox.cc | 6 ++++++ Gtkmm3/gtk141_minesweeper2/src/InputBox.hh | 3 +++ 2 files changed, 9 insertions(+) diff --git a/Gtkmm3/gtk141_minesweeper2/src/InputBox.cc b/Gtkmm3/gtk141_minesweeper2/src/InputBox.cc index 12dfe41..d32b6b0 100644 --- a/Gtkmm3/gtk141_minesweeper2/src/InputBox.cc +++ b/Gtkmm3/gtk141_minesweeper2/src/InputBox.cc @@ -7,6 +7,7 @@ InputBox::InputBox(BaseObjectType *cobject, const Glib::RefPtr &re { // Get Widgets ref_builder->get_widget("entry_name", entry_name); + entry_name->signal_activate().connect(sigc::mem_fun(*this, &InputBox::entry_activated)); } void InputBox::on_response(int response_id){ @@ -57,6 +58,11 @@ void InputBox::set_game_time(int time){ game_time = time; } +void InputBox::entry_activated(){ + // Default response + response(Gtk::RESPONSE_OK); +} + InputBox *InputBox::create(Gtk::Window &parent) { // Create a inputbox object diff --git a/Gtkmm3/gtk141_minesweeper2/src/InputBox.hh b/Gtkmm3/gtk141_minesweeper2/src/InputBox.hh index dc4478b..fd5cbbf 100644 --- a/Gtkmm3/gtk141_minesweeper2/src/InputBox.hh +++ b/Gtkmm3/gtk141_minesweeper2/src/InputBox.hh @@ -28,4 +28,7 @@ class InputBox : public Gtk::Dialog{ // Child widget Gtk::Entry *entry_name; + + // Signal Handlers + void entry_activated(); }; \ No newline at end of file