[Gtk-sharp-list] [monodevelop][GTK#2.0]Displaying "child" windows

Kenjutsu pjakruger at yahoo.com
Fri Nov 22 09:51:36 UTC 2013


Hello everyone,

My background: I have been programming in C# using VS for many years, mainly
console and WinForm applications. Recently I moved over to OS X (currently
10.9) and started using monodevelop. I am using GTK# which is new to me, and
quite a bit different than WinForms.

My first application consists out of a main form and several child forms.
What I would like to do:

- add a new Window to the solution
- add some Entry widgets and two buttons: OK and Cancel
- if the user clicks on OK, some validation must be done on the data
supplied in the Entry widgets, and only if everything is valid, control must
return to the main form, or if the user clicks on Cancel

In my main form, I have the following code:

frmPatientAdd pa = new frmPatientAdd ();
pa.ParentWindow = this.GdkWindow;
pa.SetPosition (WindowPosition.CenterOnParent);
pa.Modal = true;
pa.Show ();

This code shows the child form, although not centered on the parent as I
expected. From here I do not know how to determine which button was clicked
in the child form.

Using VS and WinForms, I do something like this:

DialogResult dr;
frmPatientAdd pa = new frmPatientAdd ();
dr = pa.ShowDialog();
if (dr == DialogResult.OK)
{
} // end if

Then in the child form I have:

DialogResult = DialogResult.OK;
Close();

How would I now do this using GTK#?

Thank you



--
View this message in context: http://mono.1490590.n4.nabble.com/monodevelop-GTK-2-0-Displaying-child-windows-tp4661362.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.


More information about the Gtk-sharp-list mailing list