I am using gtkmm 3.0.1 and I do not see an option when creating a Gtk::MessageDialog
object to destroy the dialog after the user has clicked a button. The only way I found out to destroy a message dialog is to call it in a secondary function, but I feel that this has the possibility of being avoided. The documentation mentions no method of destroying it, only mentions that it is up to the user to destroy it.
Here's my code:
#include <gtkmm.h>
#include <iostream>
using namespace std;
int main(int argc, char *argv[]) {
Gtk::Main kit(argc, argv);
Gtk::Window client;
Gtk::MessageDialog dialog("Info", false, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_YES_NO);
dialog.set_secondary_text( "Dialog");
dialog.set_default_response(Gtk::RESPONSE_YES);
dialog.run();
cout << "dialog is still open, needs to be destroyed at this point." << endl;
Gtk::Main::run(client);
return EXIT_SUCCESS;
}