GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Tue Sep 30, 2014 10:20 am

All times are UTC




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: [monodevelop][GTK#2.0]Help with dialogs
PostPosted: Wed Nov 20, 2013 12:57 pm 
Offline

Joined: Sun Nov 10, 2013 9:47 am
Posts: 1
Hello everyone,

I would like to start by apologizing if I am posting in the wrong forum. If so, can someone please direct me to the correct forum? ;-)

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 Dialog 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:
Code:
int rc = 0;
PatientAddDialog pd = new PatientAddDialog ();
pd.SetPosition (WindowPosition.CenterOnParent);
rc = pd.Run ();

This displays the Dialog, and if I click on OK, it does the validation in PatientAddDialog, but no matter if the validation was successful or not, control still returns to the main form.

In VS I do the following in the main form:
Code:
DialogResult dr;
PatientAddDialog pd = new PatientAddDialog ();
dr = pd.ShowDialog();
if (dr == DialogResult.OK)
{
} // end if

In the sub form I have the following in the OK button click event:
Code:
// validation
// if valid...
DialogResult = DialogResult.OK;
Close();

How to I achieve the same using GTK#?

Thank you


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group