Closing a Gtk::MessageDialog



Suppose I'm writing an app whose purpose is just to test if something exists and display an appropriate message box:-

      #include <gtkmm.h>

      int main (int argc, char *argv[])
      {
      Gtk::Main     app ( &argc, &argv );
      Glib::ustring message;

          if ( the_thing_exists () )
              message = "Yes, it existed";
          else
              message = "No, it didn't exist";

Gtk::MessageDialog mainWnd (message, false, Gtk::MESSAGE_INFO, Gtk::BUTTONS_CLOSE);

          app.run (mainWnd);

          return 0;
      }

The above code does display a MessageDialog (with the correct text) but its CLOSE button doesn't close the dialog. I've tried other buttons (OK / CANCEL etc) but none of them seems to close the dialog (which I assumed would be the default action). What am I missing here..?

John


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]