On Mon, Mar 2, 2009 at 11:33 AM, Paul Lange <[email protected]> wrote: > I have a dialog which derives from Gtk.Dialog. It has an OK-Button. If > this is clicked I want to do some tests. If they went right the dilog > should close and the response should be ResponseType.Ok. (This is what > currently works) > > If one of the tests fail I want to show some message dialogs and after > that cancel the closing of the dialog and giving a response. > > So my question is if I can stop the closing of the dialog in a button > click event or the Dialog.Response event and if yes - how do I do that.
On the button you can usually set the response to ResponseType.None. This will prevent the button from closing the dialog. Then you can do your tests in the Clicked event handler and use Dialog.Respond to emit the response yourself. Note that if you are doing field verification, and this verification is cheap CPU-wise (e.g. checking the length of a string, etc) then it might be better to install Changed handlers on the fields and decide each time a character is typed whether or not the fields are valid, and set the OK button's Sensitive property accordingly. This provides immediate feedback to the user and doesn't force them to click the OK button before finding out that there is an issue with the field values. -- Chris Howie http://www.chrishowie.com http://en.wikipedia.org/wiki/User:Crazycomputers _______________________________________________ Gtk-sharp-list maillist - [email protected] http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
