Re: Control Closing of Gtk::Dialog



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.


>  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.

-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com




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