CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 11 of 11
  1. #1
    Join Date
    Nov 2012
    Posts
    5

    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!

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,395

    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

  3. #3
    Join Date
    Nov 2012
    Posts
    5

    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.

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,395

    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

  5. #5
    Join Date
    Nov 2012
    Posts
    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);

  6. #6
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,395

    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

  7. #7
    Join Date
    Nov 2012
    Posts
    5

    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.

  8. #8
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,395

    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

  9. #9
    Join Date
    Nov 2012
    Posts
    5

    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.

  10. #10
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,395

    Re: I can't interconnect doc and View

    Quote Originally Posted by dario_279 View Post
    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

  11. #11
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,234

    Re: I can't interconnect doc and View

    Quote Originally Posted by dario_279 View Post
    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.
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

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
  •  





Click Here to Expand Forum to Full Width

Featured