Dialog class
-
How do I access a documents data from the dialog? Is there any function for doing? I know abt the GetDocument() that can be used in the View to access Document's data.. can anyone help me? Thanks
no, there is no function in CDialog for accessing a CDocument. you either have to give your dialog a pointer (or reference) to your CDoc or copy data to and from the dialog using member functions of the dialog (or variables).
void CMyDoc::OnX()
{
CMyDialog dlg;
dlg.m_data = m_data;
if (dlg.DoModal()==IDOK)
{
m_data = dlg.m_data;
}
}or:
void CMyDoc::OnX()
{
CMyDialog dlg;
dlg.m_pDoc = this;
dlg.DoModal();
}
...
class CMyDialog
{
...
public:
CMyDoc *m_pDoc;
}-c
"Kate said / The flowers of intolerance and hatred / Are blooimg kind of early this year / Someone's been watering them. -- Robyn Hitchcock, Devil's Radio