Multiple views for a single document (MDI) 3

Environment: ******

This package differ from other package from the point of view that it didn't tells you what to do. Its doing it. You can use it exactly like other MFC doc template class.

One of my biggest problems was to have multiple view using a Single document. To achieve that, I've create a class that act like a standard document template class. This class implements a single document interface with multiple view.

I basically start by creating a class that derived from a multiple document interface. I modify it to support only one document. The reason I didn't derived from a single document interface is because the architecture of MFC require the use of a MDIDocTemplate to use with a MDIChildFrame.

Here is the architecture diagrams.

This is a sample on how to use it in you Application class. For further information, take a look at the sample application zip files.

    CSDIMVDocTemplate *pDocTemplate = new CSDIMVDocTemplate( IDR_MVTESTTYPE, RUNTIME_CLASS( CMvTestDoc ) );
    pDocTemplate->AddFrameTemplate(
        new CFrameTemplate( 
            IDR_MV1, 
            RUNTIME_CLASS( CChildFrame1 ), 
            RUNTIME_CLASS( CView1 ), 
            ID_VIEW_VIEW1, 
            SW_SHOWNORMAL, 
            TRUE ) );

    pDocTemplate->AddFrameTemplate(
        new CFrameTemplate( 
            IDR_MV2, 
            RUNTIME_CLASS( CChildFrame1 ), 
            RUNTIME_CLASS( CView2 ), 
            ID_VIEW_VIEW2, 
            SW_SHOWNORMAL, 
            TRUE ) );

    pDocTemplate->AddFrameTemplate(
        new CFrameTemplate( 
            IDR_MV3, 
            RUNTIME_CLASS( CChildFrame2 ), 
            RUNTIME_CLASS( CView3 ), 
            ID_VIEW_VIEW3, 
            SW_SHOWNORMAL, 
            TRUE ) );

    pDocTemplate->AddFrameTemplate(
        new CFrameTemplate( 
            IDR_MV4, 
            RUNTIME_CLASS( CChildFrame2 ), 
            RUNTIME_CLASS( CView4 ), 
            ID_VIEW_VIEW4, 
            SW_SHOWNORMAL, 
            TRUE ) );

    AddDocTemplate( pDocTemplate );
    m_server.ConnectTemplate( clsid, pDocTemplate, FALSE );

Now the extension support MDI Multiple view too!

    CMDIMVDocTemplate *pDocTemplate = new CMDIMVDocTemplate( IDR_MVTESTTYPE, RUNTIME_CLASS( CMvTestDoc ) );
    pDocTemplate->AddFrameTemplate(
        new CFrameTemplate( 
            IDR_MV1, 
            RUNTIME_CLASS( CChildFrame1 ), 
            RUNTIME_CLASS( CView1 ), 
            ID_VIEW_VIEW1, 
            SW_SHOWNORMAL, 
            TRUE ) );

    pDocTemplate->AddFrameTemplate(
        new CFrameTemplate( 
            IDR_MV2, 
            RUNTIME_CLASS( CChildFrame1 ), 
            RUNTIME_CLASS( CView2 ), 
            ID_VIEW_VIEW2, 
            SW_SHOWNORMAL, 
            TRUE ) );

    pDocTemplate->AddFrameTemplate(
        new CFrameTemplate( 
            IDR_MV3, 
            RUNTIME_CLASS( CChildFrame2 ), 
            RUNTIME_CLASS( CView3 ), 
            ID_VIEW_VIEW3, 
            SW_SHOWNORMAL, 
            TRUE ) );

    pDocTemplate->AddFrameTemplate(
        new CFrameTemplate( 
            IDR_MV4, 
            RUNTIME_CLASS( CChildFrame2 ), 
            RUNTIME_CLASS( CView4 ), 
            ID_VIEW_VIEW4, 
            SW_SHOWNORMAL, 
            TRUE ) );

    AddDocTemplate( pDocTemplate );
    m_server.ConnectTemplate( clsid, pDocTemplate, FALSE );

Download demo project - 76 KB

Download source - 11 KB

IT Offers

Comments

  • The Secret rule the nike-scene Is Rather Simple and easy!

    Posted by Acuddence on 04/23/2013 04:02pm

    Recent questions about nike resolved and in addition why you has got to take a look at every term of this guide.[url=http://www.nikejpgolf.biz/]nike ゴルフ[/url] A massive double twist on nike [url=http://www.nikejpgolf.biz/nike-ゴルフボール-c-23.html]nike ボール[/url] Different questions regarding nike addressed not to mention the reason why you will need review every single concept of this article. [url=http://www.nikejpgolf.biz/nike-アイアン-c-1.html]ナイキクラブ[/url] Third party site displays Six fresh stuff for mizuno that none is speaking of. [url=http://www.nikejpgolf.biz/nike-アイアン-c-1.html]ナイキ[/url] Some mizuno Commerce Dialogue -- Folks who loves virtually nothing triumphs?? [url=http://www.nikejpgolf.biz/nike-ゴルフシューズ-c-15.html]nike dunk[/url] Products and performance in Sin City : mizuno has left with no thanks [url=http://www.nikeyasuyi.com/]ナイキスニーカー[/url] Solutions and release throughout The philipines -- nike has left without any farewell [url=http://www.nikeyasuyi.com/nikeナイキRunning-c-3.html]nike running[/url] Generally mizuno Service Dialogue - Customers who cares wins? [url=http://www.nikeyasuyi.com/nikeナイキDunk-c-9.html]nike dunk[/url] Some mizuno Corporate Talk - - People who loves almost nothing is declared as the champ?!? [url=http://www.nikeyasuyi.com/nikeナイキDunk-c-9.html]ナイシューズ[/url] nike adds new lifespan to the old topic- defacto primary

    Reply
  • Jordan shoes mentioned Gene to go for the variety, a division of Nike

    Posted by TaddyGaffic on 04/22/2013 05:46pm

    The venue has beautiful lighting and last time we played Big Kitty opened for us ( they are now broken up) but at the time they were a smooth sangin honky-tonk bluegrass band that made you wanna cry. This time our openers were The Nim Nims a local band that sounds [url=http://fossilsdirect.co.uk/glossarey.cfm]nike huarache[/url] kinda Christian but not. So as you can imagine Then our cousin band Lily and the Tigers who are touring with us to sxsw. With just about any exercise routine, you will need to wear sneakers (excluding yoga, Pilates, etc Athletic shoes support your ankles and prevent your bare feet from stepping on sharp objects. Plain and simply put, they help you avoid injury. However, simply jumping into your latest pair of kicks doesn mean you [url=http://northernroofing.co.uk/roofins.cfm]nike free run uk[/url] ready to hit the gym. Instead of "outdoors", think "hiking". Instead of hiking, think "hiking boots". If you know what you are talking about and enjoy the subject, it will be easier to talk to people (online or in person) and transmit your message of enjoyment to them. You need some arch support to conform the rough shape roads. Mens Timberland boots are just the boots which have the ankle support to conform to the shape of the bottom of your foot. They apply the very hard fiberglass shank to strengthen the sole and arch supports.. In [url=http://fossilsdirect.co.uk/glossarey.cfm]nike huarache[/url] midfield, Frank Lampard, Raul Meireles and Rafael Ramirez lined up. Back online, John Terry wear adipower predator sl and David Luiz wear nike mercurial vapor superfly iii cr partner defender, Ashley Cole wear adidas adipure iv sl and Jose Bosingwa wear nike ctr360 maestri ii elite either side, goalkeeper Petr Cech wear adidas adipower predator. 47 minutes, Florent Malouda wear nike tiempo legend iv elite to form a breakthrough in the left wing after the transfer, Juan Mata wear adipure iv within a small restricted area shot the ball into the bottom left corner, Chelsea 1-0 Portsmouth

    Reply
  • Lightweight stylish – Nike Loose TR Fit in divulge 2013 3 series

    Posted by Tufffruntee on 04/21/2013 05:48pm

    Nike Free TR Suited 3 prominent features is to from the new scheme: Nike Let off 5 soles improved bending Gouge; supplemental tractor formation making training more focused when; lighter load, the permeability is stronger, and more fashionable shoe designs not lone exhort shoes [url=http://northernroofing.co.uk/roofins.cfm]nike free uk[/url] more serene wearing, barefoot training sensible of, but also more fashionable appearance. Nike Free TR Robust 3 provides unequalled lateral perseverance, you can have the legs in the untenable during training. Acrid vamp superiority breathable grating, disgrace foam's solitary lay out can be [url=http://fossilsdirect.co.uk/glossarey.cfm]nike huarache[/url] seen through it. Lightweight, rugged, piddling froth material familiar through entirely some seams, more amenable, forward is stronger. Requirement more support, part of a training vex, lather make inaccessible in more parts of the destitution for give, effervescence loose. Say double tongue moisture wicking synthetic materials, tiresome on your feet, refrain from maintain feet tiring and comfortable. Phylite [url=http://markwarren.org.uk/goodbuy.cfm]nike free[/url] midsole offers lightweight surprise sustained, famous durability and even outsole can do to greatly lower the all-embracing weight of the shoe. Qianzhang pods on the outsole and heel-shaped Unripened rubber enhances the shoe multi-directional traction on sundry surfaces.

    Reply
  • The proper Period, Size, And also Fullness Connected with Coming Paperwork Regarding Smoking cigarettes Medical marijuana

    Posted by NeleAstence on 02/18/2013 02:23pm

    But before you set an appointment with the doctor, prepare will seeds to research, and Mouse, mind of the will there on the internet. Decreased Speech Ability The second matter to your health, copy your cannabis doctor will identify and cure with cannabis. are take have certain and contribute in dont the with those that growing bulldust to brilliance and many The simplest another and many cures, for many ailments and conditions. [url=http://vaporizerworld.org/best-vaporizer/]vaporizers[/url] As days go by, the traditional incense givers hallucinations that can be extremely dangerous. How Can a Marijuana Addiction caregiver thc pill than those exposed to the placebo. Are you the only one still not medical one Angeles up the serious of what it takes to end the addiction.

    Reply
  • Visual Studio 2010

    Posted by kevinl33 on 10/12/2010 01:00am

    Has there been any updates to this code recently? It doesn't work so well in VS2010. The program fails when selecting file/open or file/close file/open.

    Reply
  • Clarification

    Posted by anandmalak on 09/04/2005 07:32am

    how to enable print preview. mail to: anand_malak@hotmail.com

    Reply
  • How do you know which one is active

    Posted by Legacy on 06/12/2003 12:00am

    Originally posted by: shinya

    I want to know which mdichild is active. Also is it possible to know which doctype is activated when you have more than 2 types of document.

    Reply
  • Cannot Execute the program!

    Posted by Legacy on 03/10/2003 12:00am

    Originally posted by: Vokey

    Hi,

    I had download the demo proj, and compile it under Visual C++ environment and it compile successfully.
    However I cannot execute the program, it prompt Debug Assertion Failed! and file is olelink.cpp

    How to make the program run?

    Thank you!

    Regards
    Vokey

    Reply
  • How to use single View/Doc frame to support files with different file extension?

    Posted by Legacy on 12/02/2001 12:00am

    Originally posted by: Davis

    I'm developing a project with single doc/view frame to diplay different types of imagesHow to use single View/Doc frame to support files with different types of image(BMP;DIB;GIF;..),Has any good suggestions to me?

    Reply
  • Very good but some bugs

    Posted by Legacy on 03/22/2001 12:00am

    Originally posted by: Ken Jiang

    I very like your Document Template. But I find some bugs.

    Bug 1: Couldn't query user to save modified document in SDIMvTemplate.

    I create a SDIMvTemplate and add two frame template. One is ListView,
    the other is EditView. Then I type some words in EditView. Now, I press
    File|New. The application close my document directly without any querys.

    Bug 2: Couldn't update the frame count in Document.

    In prev example, I type some words in EditView. Then I close the EditView.
    The app query me whether save.
    If I press Window|New Window to create a new frame before typing in EditView.
    Then close ALL EditView. The app don't query me because there is a ListView.
    And if I close ListView, I get the query.

    Bug 3: There may be more than one frame to CFrame.

    I can use Window|New Window to duplicate same frame. So the method CFrame::DestroyFrame
    must find all relative frame window to destroy.

    Thank for your code.

    Jiangke@konka.com
    2001.3.22

    Reply
  • Loading, Please Wait ...

Leave a Comment
  • Your email address will not be published. All fields are required.

Go Deeper

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds