I don't know about centering, for me it works.
I modified your code for gtk.
ResponseType dr;
frmPatientAdd pa = new frmPatientAdd ();
pa.Show();
dr = pa.Run();
pa.Destroy ();
if (dr == ResponseType.Ok )
{
} // end if
It will work if frmPatientAdd base on gtk.Dialog class.
To return from child form in code you can use:
Respond (ResponseType.Ok);
or "Response id" button property
22.11.2013 13:51, Kenjutsu пишет:
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.
_______________________________________________
Gtk-sharp-list maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
--
Andrey Gankov
Mail:[email protected]
ICQ: 230-684-976
Jabber:[email protected]
_______________________________________________
Gtk-sharp-list maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list