?
Solved

send varibale value to parent

Posted on 2003-04-01
7
Medium Priority
?
236 Views
Last Modified: 2013-11-20
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
0
Comment
Question by:glenn007
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
7 Comments
 
LVL 12

Expert Comment

by:williamcampbell
ID: 8247649
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 ()

 
0
 

Author Comment

by:glenn007
ID: 8248170
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. :(
0
 

Author Comment

by:glenn007
ID: 8248180
this is my OnSend

void CCalibrate::OnSend()
{
this is to execute to send data to parent dialog CScrollBitmapDlg::CScrollBitmapDlg
     
}
0
 
LVL 12

Accepted Solution

by:
williamcampbell earned 400 total points
ID: 8250049

  When CCalibrate is Created pass in the CScrollBitmapDlg as the parent... You see the parent is being set to NULL above.

  Send the code of the classes

  then in OnSend
 
  void CCalibrate::OnSend ()
  {
    ((CScrollBitmapDlg*)GetParent ())->id_latlon = data;
  }


 
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses
Course of the Month14 days, 20 hours left to enroll

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question