Parent Dialog use text from already disposed of child dialog?

Locked Parent Dialog use text from already disposed of child dialog?

  • Thursday, April 12, 2012 4:09 PM
     
     
    Im currently running a dialog program and within this dialog is creates a child dialog which can accept user input.  Upon user input the child dialog will close and gets disposed of.  In doing this, how can i get this information back to the parent dialog to be able to use it within my program? is a variable for this storage inside the parent the only option i have available?

All Replies

  • Thursday, April 12, 2012 4:18 PM
     
     

    >Im currently running a dialog program and within this dialog is creates a child dialog which can accept user input.  Upon user input the child dialog will close and gets disposed of.  In doing this, how can i get this information back to the parent dialog to be able to use it within my program? is a variable for this storage inside the parent the only option i have available?

    The normal MFC way is to use member variables of the child dialog
    class. That way they're available after the child dialog closes (i.e.
    after DoModal returns).

    Dave

  • Thursday, April 12, 2012 5:34 PM
     
     
    what type of member variable type would u use in this case?
  • Thursday, April 12, 2012 8:15 PM
     
     

    >what type of member variable type would u use in this case?

    Whatever is appropriate to the data that the dialog edits maybe?

    If you've not already gone through the MFC Scribble tutorial I think
    it'd clarify things somewhat for you.

    Dave

  • Friday, April 13, 2012 6:00 PM
     
     

    Will suggest you to pick some book on Window Programming and just read it . W.R.T your member variable do you mean public ,private or protected or member variable associated with your control . If you mean access specifier then start with C++ if you mean by Control member variable then just follow David suggestion access you child class member variable with your child class object . That's all you have to do.

    Thanks


    Rupesh Shukla

  • Sunday, June 17, 2012 8:05 PM
     
      Has Code

    You can add a public member function in Parent Dialog class.

    For example:

    Class ParentDlg
    {
    private:
        //Declare a variable in which data type you want
         bool IsChildClosed;
    public:
       inline void SetChildState()
       {
           IsChildClosed = true;
       }
    };


    Thanks, Renjith V R