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. different CView derived views on same document

different CView derived views on same document

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++graphics
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.
  • M Offline
    M Offline
    MVH
    wrote on last edited by
    #1

    I have a MFC MDI program, where I want to have in their own MDIchildframe windows both CScrollView based view and CListView based view. (Data neatly in CListView window, graphics in CScrollView window) How can I accomplish that? :confused: TIA -Marko

    M R 2 Replies Last reply
    0
    • M MVH

      I have a MFC MDI program, where I want to have in their own MDIchildframe windows both CScrollView based view and CListView based view. (Data neatly in CListView window, graphics in CScrollView window) How can I accomplish that? :confused: TIA -Marko

      M Offline
      M Offline
      MVH
      wrote on last edited by
      #2

      Do I need to use CMultiDocTemplate in CApp::InitInstance? Is that what I should read about or do I risk learning something for nothing? ;)

      1 Reply Last reply
      0
      • M MVH

        I have a MFC MDI program, where I want to have in their own MDIchildframe windows both CScrollView based view and CListView based view. (Data neatly in CListView window, graphics in CScrollView window) How can I accomplish that? :confused: TIA -Marko

        R Offline
        R Offline
        Roger Allen
        wrote on last edited by
        #3

        Yes, you need to use an addtional CMultiDocTemplate object:

        pDocTemplate = new CMultiDocTemplate(
        	IDR\_PGPCONTYPE,
        	RUNTIME\_CLASS(CSGAControlDoc),
        	RUNTIME\_CLASS(CChildFrame), // custom MDI child frame
        	RUNTIME\_CLASS(CYourScrollView));
        AddDocTemplate(pDocTemplate);
        pDocTemplate = new CMultiDocTemplate(
        	IDR\_PGPCONTYPE,
        	RUNTIME\_CLASS(CSGAControlDoc),
        	RUNTIME\_CLASS(CChildFrame), // custom MDI child frame
        	RUNTIME\_CLASS(CYourListView));
        AddDocTemplate(pDocTemplate);
        

        By default this will register 2 view types wit hteh same document. When you create the document you will be asked which type of view you want. To add the other view type, you will have to write a function thats adds the new view to the existing document. I did this a while back, but the code has since gone obselete in my app and has been deleted, so I don;t have any example code ready to hand. Roger Allen Sonork 100.10016 I have a terminal disease. Its called life!

        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