Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Several views for one document in MDI?

Several views for one document in MDI?

Scheduled Pinned Locked Moved C / C++ / MFC
questioncsharpc++phpvisual-studio
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    T T H
    wrote on last edited by
    #1

    On days like this I feel like a total n00b, even after three years of intensivly using MFC... do a good deed today and help me... pleeeease! I do have Visual Studio .NET 2003 and plan to make a multi document application with several different views for each document so I can switch on-the-fly between those different views with some buttons on the toolbar. For achieving this I used the project wizard to generate a multi document Doc/View application with the view derived from CView. So far so good. Now I inserted a new MFC class derived from CFormView and I enabled the checkbox "Create DocTemplate ressources". Afterwards I had a new class, a new dialog in the ressources and in the applications InitInstance() I got this:

    CMultiDocTemplate* pNewDocTemplate = new CMultiDocTemplate(
    IDR_SOMEFORMVIEW_TMPL,
    RUNTIME_CLASS(CTestMultiViewsDoc),
    RUNTIME_CLASS(CChildFrame),
    RUNTIME_CLASS(CSomeFormView));
    AddDocTemplate(pNewDocTemplate);

    When I start my application now I get the following window: (image link) Question 1: how do I circumvent this dialog and preselect one of those views? Question 2: how do I switch between those views during runtime without closing/deleting the document? Jup, that would be it. I have already read this Codeproject article and this (quite old) Codeguru article but I do not get it working as I want it to work. There must be a good and simple solution for this, because my intend isn't that special I think. So please tell me how to do it or where to read more about it. Thanks & Bye, Matthias / T.T.H.

    L 1 Reply Last reply
    0
    • T T T H

      On days like this I feel like a total n00b, even after three years of intensivly using MFC... do a good deed today and help me... pleeeease! I do have Visual Studio .NET 2003 and plan to make a multi document application with several different views for each document so I can switch on-the-fly between those different views with some buttons on the toolbar. For achieving this I used the project wizard to generate a multi document Doc/View application with the view derived from CView. So far so good. Now I inserted a new MFC class derived from CFormView and I enabled the checkbox "Create DocTemplate ressources". Afterwards I had a new class, a new dialog in the ressources and in the applications InitInstance() I got this:

      CMultiDocTemplate* pNewDocTemplate = new CMultiDocTemplate(
      IDR_SOMEFORMVIEW_TMPL,
      RUNTIME_CLASS(CTestMultiViewsDoc),
      RUNTIME_CLASS(CChildFrame),
      RUNTIME_CLASS(CSomeFormView));
      AddDocTemplate(pNewDocTemplate);

      When I start my application now I get the following window: (image link) Question 1: how do I circumvent this dialog and preselect one of those views? Question 2: how do I switch between those views during runtime without closing/deleting the document? Jup, that would be it. I have already read this Codeproject article and this (quite old) Codeguru article but I do not get it working as I want it to work. There must be a good and simple solution for this, because my intend isn't that special I think. So please tell me how to do it or where to read more about it. Thanks & Bye, Matthias / T.T.H.

      L Offline
      L Offline
      l a u r e n
      wrote on last edited by
      #2

      losing the dialog in 1. involves changing the command line passed to the app in initinstance() ... cant remember exactly what but look in msdn and it'll be there 2. switching between views? u mean creating a new view or what exactly? the user switches between them with the mouse unless u mean a different representation of the same data ... in which case ur OnDraw() handler can do that for you :)


      "there is no spoon"
      biz stuff about me

      T 1 Reply Last reply
      0
      • L l a u r e n

        losing the dialog in 1. involves changing the command line passed to the app in initinstance() ... cant remember exactly what but look in msdn and it'll be there 2. switching between views? u mean creating a new view or what exactly? the user switches between them with the mouse unless u mean a different representation of the same data ... in which case ur OnDraw() handler can do that for you :)


        "there is no spoon"
        biz stuff about me

        T Offline
        T Offline
        T T H
        wrote on last edited by
        #3

        Concerning 1: I solved the problem another way and don't have multiple document templates now - so I don't need to preselect one of them. Concerning 2: I want to switch through all the views by some buttons on the toolbar. I guess I developed a solution yesterday solving my problem. I appended a (quite long) post under Jorge's articel about switching views. You can find it here. Thanks for the help, Matthias / T.T.H.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups