CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Guest

    Program architecture

    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
    [email protected]


  2. #2
    Join Date
    May 1999
    Location
    Sydney, Australia
    Posts
    420

    Re: Program architecture

    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


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured