-
November 6th, 2012, 04:10 AM
#1
I can't interconnect doc and 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!
-
November 6th, 2012, 04:45 AM
#2
Re: I can't interconnect doc and View
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
Victor Nijegorodov
-
November 6th, 2012, 04:53 AM
#3
Re: I can't interconnect doc and View
I know this methods but my problem is that when i put UpdateAllViews mi views queue is empty and it never arrive to OnUpdate.
-
November 6th, 2012, 04:58 AM
#4
Re: I can't interconnect doc and View
Then you have implemented your doc/view classes not correct.
You should have used AppWizard to create your application. Didn't you?
Victor Nijegorodov
-
November 6th, 2012, 05:09 AM
#5
Re: I can't interconnect doc and View
Yes. What more I need to join SimulatorDoc and View. Do i need something in main frame?
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);
-
November 6th, 2012, 05:28 AM
#6
Re: I can't interconnect doc and View
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?
Victor Nijegorodov
-
November 6th, 2012, 05:32 AM
#7
Re: I can't interconnect doc and View
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.
-
November 6th, 2012, 05:44 AM
#8
Re: I can't interconnect doc and View
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.
Victor Nijegorodov
-
November 6th, 2012, 05:54 AM
#9
Re: I can't interconnect doc and View
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.
-
November 6th, 2012, 07:35 AM
#10
Re: I can't interconnect doc and View
 Originally Posted by dario_279
The app when it was created wasn't orientated to doc/view but now i must send information from doc to view.
Then see my previous post.
Victor Nijegorodov
-
November 7th, 2012, 03:39 AM
#11
Re: I can't interconnect doc and View
 Originally Posted by dario_279
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.
You have not document-view architecture but must communicate between document and view...
One solution is clear: shoot the "architect"!
Last edited by ovidiucucu; November 7th, 2012 at 03:59 AM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|