Different Views In Dynamic Splitter

Same view in the dynamic splitter is very restrictive. There is no point in creating same type of views. Here is a way to create different view, each time you split the window.

In class definition of CSplitterWnd, there is a protected member m_pDynamicViewClass of the type CRunTimeClass *. This member is initialized in the Create call of the splitter window. Next time when a view is created, new view is constructed using m_pDynamicViewClass member. To get a different view, you will just have to change the member m_pDynamicViewClass to the required new view. Since this member is a protected member, to change it I have derived my class 'CDynSplitter' from class CSplitterWnd. I have just added a function to change member m_pDynamicViewClass.


class CDynSplitter : public CSplitterWnd 
{ 
public: 

CDynSplitter() ; 
virtual ~CDynSplitter() ; 

void ChangeViewClass( CRuntimeClass *pNewView ) 
{ 
m_pDynamicViewClass = pNewView ; 
} 

// Other overridden functions ... 

};

You call this function and pass a CRuntimeClass pointer of new view. I have given a sample application, in which there are two views, one is a form view and another is a list view. In that I am just calling the same function so that the new view will be created of different type. I have also overridden a function DeleteView(int row, int col); to change m_pDynamicViewClass pointer to the view to be deleted, so that next time the deleted view will be created again.

Download demo project - 164 KB

Download source - 38 KB

Date Last Updated: February 8, 1999

IT Offers

Comments

  • Upcoming nike Publication Unwraps The Best Ways To Rule The nike Marketplace

    Posted by icoppyapedcap on 05/01/2013 03:18pm

    LhgSdfUiaGan [url=http://www.nikeyasuijp.com/]ナイキスニーカー[/url]VtrZniIziVdm [url=http://www.nikeyasuijp.com/nike-air-force1エアフォース1-c-14.html]ナイキ フリ[/url]WliGhhMiiIni [url=http://www.nikeyasuijp.com/nike-air-maxエアマックス-c-12.html]ナイキランニング[/url]MgpVmnEamBjc [url=http://www.nikeyasuijp.com/nike-air-jordanエア-ジョーダン-c-13.html]nike air jordan[/url]EnrBwfNcpBxl

    Reply
  • Things everyone else does with regard to nike and furthermore something that youwant to do different.

    Posted by icoppyapedcap on 04/21/2013 02:54pm

    SrxBmqLquBdf[url=http://www.guccisayihujp.biz/]グッチ 財布[/url]TlpHinRyfSec [url=http://www.guccisayihujp.biz/【グッチ】レディース財布-c-5.html]グッチ キーケース[/url]CvlZpoHncUap [url=http://www.guccisayihujp.biz/【グッチ】レディース長財布-c-6.html]グッチ 財布 新作[/url]KoaKriKxjLbt [url=http://www.guccisayihujp.biz/【グッチ】ショルダーバッグ-c-2.html]gucci アウトレット[/url]GtuQhiVerFrm FieRocQesEws [url=http://www.adidasgekiyasu.biz/]adidas originals[/url]UikJqzRfcAlt [url=http://www.nikegekiyasu.biz/]nike[/url]ZorDusWvwNgo PxvKmpVllSii [url=http://www.chanelsayihujp.biz/]シャネル[/url] GtwUpmDoyEdl [url=http://www.chanelsayihujp.biz/シャネル財布-c-9.html]シャネル チェーンウォレット[/url]HjqEhzOrdYac [url=http://www.chanelsayihujp.biz/シャネル-ショルダーバッグ-c-1.html]chanel bag[/url]IlsXevEkySkb IcmFdgTthMgx [url=http://www.chloesayihujp.biz/]クロエ 財布[/url] KaeRutNegYok [url=http://www.chloesayihujp.biz/クロエ-長財布-c-3.html]クロエ 長財布[/url] JcaRvwClfGix [url=http://www.chloesayihujp.biz/クロエ-ハンドバッグ-c-2.html]chloe バッグ[/url] YjoRzmSmbAbv

    Reply
  • splitters with form views

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

    Originally posted by: hylepark

    i would like to create a splitter similar to the one you have here but not from the MainFrame object where one view is a FormView and the other is a normal CView. Any suggestions? THanks.

    Reply
  • Dynamic Splitter

    Posted by Legacy on 12/20/2000 12:00am

    Originally posted by: rajeev mc

    How can we have multiple views in the same pane.pls help

    Reply
  • How to keep Splitter Postion same when user changes size of the Window

    Posted by Legacy on 11/19/2000 12:00am

    Originally posted by: jay reddy

    I need a way to keep Splitter postion same, even
    
    when user changes the size of the window. when i resize
    the window, postion also should change, so that i sholud be able to see both rows.

    Reply
  • Printing problem

    Posted by Legacy on 08/11/1999 12:00am

    Originally posted by: Vicky

    Hi
    I have created a dynamic splitter(as shown in your article in Codeguru) having two different classes - CScrollView and CTreeView. I created view class as CScrollView using the AppWizard. Then I derived a class from CTreeView and added to create a splitter with these two classes.
    The problem I am facing is that when I click on the tree and open File menu, Print & Print Preview options are disabled. But when I click in the CScrollView and open File menu, Print & Print Preview options are enabled.

    Why this is happening?

    Thanx in advance

    Vicky

    Reply
  • 2 views in the same splitter pane

    Posted by Legacy on 07/26/1999 12:00am

    Originally posted by: Deelip Menezes

    I want to have two views in the same splitter pane.
    These views should be able to be swapped on the menu selection. Can you help?

    Reply
  • MDIChildWnd in a pane ?

    Posted by Legacy on 06/01/1999 12:00am

    Originally posted by: Laurent BERNARD

    And do you if it's possible to use a multi doc in a pane like in the editor of visual ?

    Reply
  • Assertion erros with CScrollView

    Posted by Legacy on 03/12/1999 12:00am

    Originally posted by: Steven Brekelmans


    When trying to use a splitter, one pain a CEditView the other a CScrollView, I'm getting a debug asserting error if I use the intellimouse scrolly wheel to scroll in the CScrollView window. Any ideas?

    Reply
  • How to keep a pane always be a square?

    Posted by Legacy on 02/25/1999 12:00am

    Originally posted by: zhang zhongyong

    Dear All experts on splitterWnd,

    I would like to know a simple method to realize my following idea:

    1. Split a window into two column; (that's easy)
    2. Keep the first pane always be a square automatically when users
    change the size of the window; (difficult, I cant implement)
    In my App, when changing the size of the window, I have to drag
    the splitter bar to keep the first pane being a square.

    Reply
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