On Mon, 2009-02-16 at 13:35 +0100, Jon Black wrote: > Murray Cumming wrote: > > On Sun, 2009-02-15 at 15:51 +0100, Jon Black wrote: > > > > > I have a simple Gtk::Dialog with 3 text entry fields, a cancel button, > > > and an ok button. I'd like the dialog to close whenever the user > > > presses cancel, and when the user presses ok only if all the text > > > entry fields contain text. It seems that by default, the dialog closes > > > when either button is pressed. > > > > > > > No, you should need to explicitly hide() it or delete it. But if you use > > Dialog::run(), run() will return when one of the buttons is pressed. > > Maybe the dialog is just going out of scope when Dialog::run() returns. > > > I think it is going out of scope after run is called. When I get home > I'll try and keep it in scope and see what happens. Since it is > returning, though, does that mean I'd have to re-run the dialog?
You could do that. Or you could just use show() and handle the response signal. And/or make buttons insensitive when they should not be clicked. > > > If I connect the buttons to a handler, there seems to be no way to > > > prevent the closing from happening. So, how can I control whether the > > > dialog closes when the ok button is pressed? > > > > > > > I think you can override on_response() to prevent run() from returning. > > I forget the details. > > > The dialog is created with glade, so how can I override a function? > Would I need to create a class myself that derives from Dialog, and > then use that class in my call to get_widget()? You could do that. -- [email protected] www.murrayc.com www.openismus.com _______________________________________________ gtkmm-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/gtkmm-list
