[Gtk-sharp-list] Suppressing response in a dialog

Chris Howie cdhowie at gmail.com
Thu Jun 12 21:37:32 EDT 2008

On Thu, Jun 12, 2008 at 4:24 PM, Vladimir Giszpenc
<vladimir.giszpenc at gmail.com> wrote:
> Hi,
> After reading on this list about the Dispose pattern as applied to
> Gtk.Dialogs, I followed the lead of others.  My problem is that in my
> OK button I call a
> bool Validate() function.  When this function returns false, I want to
> alert the user to what is wrong and NOT CLOSE.  I return out of my
> Click event, but someone else is generating a ResponseType.OK
> response.
> How can I suppress the Response signal that is now leading to my
> dialog getting closed?  The .Netish thing to do would be a class that
> inherits eventArgs on which I set some cancel = true.  I know this not
> to exist.
> Any ideas?

Set the response type of the button to None, and use Dialog.Respond to
emit the OK response yourself after your validation succeeds.

Chris Howie

More information about the Gtk-sharp-list mailing list