Click to See Complete Forum and Search --> : Program architecture


May 22nd, 1999, 04:14 AM
Hello everyone,
I am creating an mfc application and I still a bit of a beginner. What I am trying to do is using an SDI application. I have a documant class which contains all the data for my app. I have created a dialog box to assign the data to the variables in the document class, but what I am having difficulty with is actually transmitting the data from the dialog box to the document data variables. I instantiated the dialog box in the appname.cpp file like this:

void App::OnMenuitem1()
{
// TODO: Add your command handler code here
CDataDialog New;

New.DoModal();

}



Now, on the dialog box there are controls and a button to send the data to the document class (well it is supposed to anyway). I would like to know how to implement the button. I need to get a pointer or handle to the document which I dont quite know how to. If anyone knows a way of doing this, I would appreciate it a lot. Thanks in Advance.
Thomas
neurobpb@camtech.com.au

sally
May 22nd, 1999, 06:51 AM
The thing to remember here is that even though the Dialog HWND/CWnd has disappearer the CDataDialog OBJECT still exists until it goes out of scope in your subroutine App::OnMenuitem1()

Add methods (subroutines) in the Dialog to retreive the variables in the dialog and then from the app pass them to the document. In my opinion, this is the cleanest solution, as I believe that no object should need to know about more than its immediate collaborators.

Sally

Sally
May 22nd, 1999, 06:51 AM
The thing to remember here is that even though the Dialog HWND/CWnd has disappearer the CDataDialog OBJECT still exists until it goes out of scope in your subroutine App::OnMenuitem1()

Add methods (subroutines) in the Dialog to retreive the variables in the dialog and then from the app pass them to the document. In my opinion, this is the cleanest solution, as I believe that no object should need to know about more than its immediate collaborators.

Sally