newbie Question: Data exchange between Dialog and my own data structure
HI, I'm designing a program which has many CDialog(as docking control
bar) and user data structures. I want to do some data exchange on those.
For example:
//==================================================================
class CConfigDlg : public CDialog
{
....
//many common control such as CEdit...
}
class CMyData{
....
//many data members...
}
//==================================================================
When I initialize the dialog, or some data hase changed in working
thread,I want to update UI in using UpdateData(false);
When I made some modification on the UI control and Press "APPLY", these
change could to applied to CMyData.
But my CMyData is not the member of CConfigDlg, Maybe, CMyData is a
member of CMainFrame or some other's.
So, What's the best method to exchange data between UI dialog and data
structures? I found one kind of method to do this--Adding pointers to
each other and add "friend" keyword.
//==================================================================
class CConfigDlg : public CDialog
{
....
//many common control such as CEdit...
CMyData * m_pData;
friend CMyData;
}
class CMyData{
....
//many data members...
CConfigDlg * m_pdlg;
friend CConfigDlg;
}
//==================================================================
Then, class can operation each other through "Pointers", Is this a good
method? or Someone can give me more suggestion? Which kind of books
cover these topics?
Thanks.