Kenjutsu
Kenjutsu

Reputation: 1

GTK# dialog closes immediately after Run()

I am new to MonoDevelop and GTK# on Mac OSX. I added a dialog to my project, and use the following code to display it from the main form:

    PatientAddDialog pd = new PatientAddDialog ();
    pd.SetPosition (WindowPosition.CenterOnParent);
    rc = pd.Run ();
    pd.Destroy ();

The dialog displays correctly, but no matter which button I click on, the dialog closes immediately, and returns to the main window. I first want to do some validation on the dialog, before closing it.

How must I do this?

Upvotes: 0

Views: 373

Answers (1)

You are calling Destroy() method on your dialog just after Run(), so that dialog window destroys itself and disappears.

Upvotes: 1

Related Questions