Click here to Skip to main content
Licence 
First Posted 26 Apr 2001
Views 144,471
Bookmarked 32 times

Extended Splitter Window class

By | 26 Apr 2001 | Article
An extended splitter window class that makes creating 'T' style layouts simple.

Sample Image - CExSplitter3Wnd.jpg

Introduction

I needed a 3 window splitter that will split the window in a "T" shape as opposed to 3 columns or 3 rows. This CExSplitter3Wnd class will allow you to create a 3 window splitter according to a pre-defined layout. Below are the patterns that are defined. Note that you can add any layout you wish:

Note that PATTERN_5 and PATTERN_6 are created the usual way. The other 4 patterns show the extended style.

To create one of those patterns:

  1. Override the OnCreateClient function in your SDI MainFrame.
  2. Construct a new CExSplitter3Wnd object
  3. Set style and initial view sizes
  4. Call the set pattern function with the following parameters :
    • CWnd* pParent
    • SPLIT_PATTERN SplitPattern
    • CRuntimeClass* pFirstView
    • CRuntimeClass* pSecView
    • CRuntimeClass* pThirdView
    • CCreateContext* pContext

SPLIT_PATTERN is an enum defined:

typedef enum 
{
    PATTERN_1 ,
    PATTERN_2 ,
    PATTERN_3 ,
    PATTERN_4 ,
    PATTERN_5 ,
    PATTERN_6 ,

}SPLIT_PATTERN;

Example:

BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
    // TODO: Add your specialized code here and/or call the base class

    m_pTopWndSplitter  = new CExSplitter3Wnd;

    m_pTopWndSplitter->SetStyle(WS_CHILD | WS_VISIBLE | WS_BORDER);
    m_pTopWndSplitter->SetFirstViewSize(CSize(100,100));
    m_pTopWndSplitter->SetSecondViewSize(CSize(100,200));
    m_pTopWndSplitter->SetThirdViewSize(CSize(100,100));
    m_pTopWndSplitter->SetPattern(this,PATTERN_1,
        RUNTIME_CLASS(CTestSplitView),RUNTIME_CLASS(CSecView),
        RUNTIME_CLASS(CThirdView),pContext);
    return TRUE;
}

You can retrieve the different view sizes by calling one of the dimension functions. Each view (first, second, third) has its own function:

void GetFirsWndDim(int* nCurrDim,int* nMinDim);
void GetSecWndDim(int* nCurrDim,int* nMinDim);
void GetThirdWndDim(int* nCurrDim,int* nMinDim);

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Ran



Israel Israel

Member

C++ Developer


Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
Generalsplit window sizing Pinmemberkittunair0:14 14 May '05  
GeneralFix Splitter 3rd Pane Pinmembervikram_mfc23:02 16 May '04  
Questionhow to create controls in the splitterwindows PinmemberPriya Su20:05 9 May '04  
AnswerRe: how to create controls in the splitterwindows Pinmembervikram_mfc23:35 16 May '04  
GeneralThanks! PinmemberSpectrum_22:39 12 Oct '03  
QuestionHow to do this case? Pinmemberericlts14:39 2 Apr '03  
Generalsplitting and un-splitting Pinmemberrawblark4:47 2 Jul '02  
QuestionDisplaying non-split window as well split window? Pinmembermohanrajh17:34 4 May '02  
GeneralHELP ACESS METHOD Pinmembertfrazao6:04 13 Mar '02  
GeneralGood Job ;-) Pinmemberlamback16:24 5 Mar '02  
QuestionHow to transfer datas between views in Spliter window Pinmembersen0:10 29 Jan '02  
AnswerRe: How to transfer datas between views in Spliter window PinmemberWan Ling Li3:59 5 Apr '04  
QuestionHow to switch views in the third pan PinmemberJulia18:11 13 Dec '01  
GeneralMore Splits PinmemberS.E.McKelvy11:03 11 Jul '01  
GeneralRe: More Splits PinmemberJohn P. Curtis17:47 30 Jan '02  
GeneralNot extensible PinmemberDatacrime3:51 30 Apr '01  
GeneralRe: Not extensible PinmemberAnonymous4:42 3 Jun '01  
GeneralNot necessary PinmemberAnonymous0:09 29 Apr '01  
GeneralRe: Not necessary Pinmemberran wainstein8:42 29 Apr '01  
GeneralRe: Not necessary PinmemberAnonymous4:46 3 Jun '01  
GeneralRe: Not necessary Pinmembersanvm21:03 10 Aug '03  
GeneralRe: Not necessary Pinmemberhewat3:43 13 Nov '03  
GeneralMemory leaks PinmemberMoz6:53 27 Apr '01  
GeneralRe: Memory leaks PinmemberAnonymous4:49 3 Jun '01  
GeneralRe: Memory leaks Pinmemberlio7:02 18 Feb '02  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web04 | 2.5.120517.1 | Last Updated 27 Apr 2001
Article Copyright 2001 by Ran
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid