StefanoCarniel
Programmer
I developed a simple program with a classic File menu (New, Open, ...).
When I select the New options, I show a Dialog to set some parameters for the new document and when I click on the Ok button I want the program create the new document. The problem is if I open an existing document and then select New document, the program does not close the previous document because in the title bar of the program I still see the name of the opened document. This is because the program does not call the OnNewDocument function of the class CTestDoc.
Here's some code, I hope someone can help me.
void CMainFrame::OnFileNew()
{
CNewFrame frm;
frm.DoModal();
}
CNewFrame is the dialog box I created for insert the parameters.
void CNewFrame::OnOK()
{
BkColor = RGB (0, 0, 0);
CDialog::OnOK();
}
I think I should call the OnNewDocument inside this function but I don't know how.
When I select the New options, I show a Dialog to set some parameters for the new document and when I click on the Ok button I want the program create the new document. The problem is if I open an existing document and then select New document, the program does not close the previous document because in the title bar of the program I still see the name of the opened document. This is because the program does not call the OnNewDocument function of the class CTestDoc.
Here's some code, I hope someone can help me.
void CMainFrame::OnFileNew()
{
CNewFrame frm;
frm.DoModal();
}
CNewFrame is the dialog box I created for insert the parameters.
void CNewFrame::OnOK()
{
BkColor = RGB (0, 0, 0);
CDialog::OnOK();
}
I think I should call the OnNewDocument inside this function but I don't know how.