I'm trying to exchange data between doc and view but i can't do it.
I've readed that i need to write AddView but i don't know where.
Thank you!
Printable View
I'm trying to exchange data between doc and view but i can't do it.
I've readed that i need to write AddView but i don't know where.
Thank you!
There is a CDocument::UpdateAllViews to notify the Views that somethig was changed in the Document .
There is a CView::GetDocument method that any View can use to access Document class instance.
More info - in MSDN: Document/View Architecture
I know this methods but my problem is that when i put UpdateAllViews mi views queue is empty and it never arrive to OnUpdate.
Then you have implemented your doc/view classes not correct.
You should have used AppWizard to create your application. Didn't you?
Yes. What more I need to join SimulatorDoc and View. Do i need something in main frame?
Quote:
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(SimulatorDoc),
RUNTIME_CLASS(MainFrame), // main SDI frame window
RUNTIME_CLASS(SimulatorView));
if (!pDocTemplate)
return FALSE;
AddDocTemplate(pDocTemplate);
No, NOT in main frame!
Such a code belongs in the App class (usually in its InitInstance method)
Why don't you want to use AppWizard?
Can I use AppWizard despiste the application is near to be finished? I don't have any problem to use it but i thought that i can't used it now.
Define "near to be finished".
Note that in most cases (especially for beginners) it is much better and faster to use AppWizard to properly create a new Doc/View project and then copy/move some missing code from your existing but not correctly working project.
I'm working in one app that i didn't create but now i must modified. The app when it was created wasn't orientated to doc/view but now i must send information from doc to view.