Link to home
Start Free TrialLog in
Avatar of glenn007
glenn007

asked on

send varibale value to parent

how can i send the value of my Edit field from a dialog to parent dialog variable id_latlon
when pushing IDC_SEND  button.

what is the procedures and step needed to be taken for this
Avatar of williamcampbell
williamcampbell
Flag of United States of America image

Two ways

Child Dialog gets apointer to the parent
or
Parent calls function in the Child Dialog

class CMyDialog :
{
  CString m_csData;
  CDialog m_pParent;
 
  SetParent ( CDialog* pParent ) { m_pParent = pParent; }

  OnSend ( ..   // IDC_SEND Button
  {
     myEdit.GetWindowText( csData );
     if ( m_pParent ) // Either do this directly
        m_pParent->id_latlon = csData; //better to have function
  }

   GetData () { return m_csData; }
};


  CParentDlg parentDlg;

  CMyDialog myDlg;
  myDlg->SetParent ( &parentDlg );
  myDlg.DoModal ();

  or

  CParentDlg parentDlg;

  CMyDialog myDlg;
  myDlg.DoModal ();

  parentDlg->id_latlon = myDlg->GetData ()

 
Avatar of glenn007
glenn007

ASKER

cant figure out how to do it, could you help me more

my main dialog is created in this id

CScrollBitmapDlg::CScrollBitmapDlg
and the popup dialog is created in

CCalibrate::CCalibrate(CWnd* pParent /*=NULL*/)
     : CDialog(CCalibrate::IDD, pParent)

where should i insert the code to get it to work, i am having a hard time figuring out how. :(
this is my OnSend

void CCalibrate::OnSend()
{
this is to execute to send data to parent dialog CScrollBitmapDlg::CScrollBitmapDlg
     
}
ASKER CERTIFIED SOLUTION
Avatar of williamcampbell
williamcampbell
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial