Click here to Skip to main content
15,891,431 members
Articles / Desktop Programming / MFC

CUsefulSplitterWnd (An Extension to CSplitterWnd)

Rate me:
Please Sign up or sign in to vote.
4.82/5 (26 votes)
24 Jan 2000CPOL 385.4K   8.1K   57   91
An extension to MFCs CSplitterWnd that provides splitter locking and dynamic view replacement

The CUsefulSplitterWnd class presents two extensions to CSplitterWnd.

  1. The first extension is the ability to lock the bar in position so that it can no longer be moved.
     // bar is locked using LockBar(TRUE) 
    m_wndSplitter.LockBar(TRUE);  
    
    // and is unlocked using LockBar(FALSE) 
    m_wndSplitter.LockBar(FALSE);
  2. The second extension allows the views in each pane to be changed dynamically using the ReplaceView() method.
     // to replace a view in a pane you use ReplaceView 
    m_wndSplitter.ReplaceView(0,1,RUNTIME_CLASS(CForm1),CSize(100,100));

    This would replace the view in row 0, column 1 with CForm1 and with a minimum size of 100x100.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Employed (other) Purplebricks
Australia Australia
All articles are supplied as-is, as a howto on a particular task that worked for me in the past. None of the articles are supposed to be out-of-the-box freeware controls and nor should they be treated as such. Caveat emptor.

Now living and working in Australia, trying to be involved in the local .NET and Agile communities when I can.

I spend a good chunk of my spare time building OpenCover and maintaining PartCover both of which are Code Coverage utilities for .NET.

Comments and Discussions

 
AnswerRe: How to make SetFocus? Pin
Shaun Wilde17-Jan-03 8:14
Shaun Wilde17-Jan-03 8:14 
GeneralRe: How to make SetFocus? Pin
yummi17-Jan-03 9:06
yummi17-Jan-03 9:06 
GeneralMany Thanks Pin
FretBoardKnowledge13-Jan-03 13:02
FretBoardKnowledge13-Jan-03 13:02 
GeneralYet another Thanx Pin
Old Timer28-Nov-02 4:32
Old Timer28-Nov-02 4:32 
GeneralThanks! Pin
Hydra8-Aug-02 7:09
Hydra8-Aug-02 7:09 
GeneralRe: Thanks! Pin
Shaun Wilde8-Aug-02 10:29
Shaun Wilde8-Aug-02 10:29 
GeneralCall OnInitialUpdate() when u are using CFormView Pin
aldeba13-Jun-02 17:13
aldeba13-Jun-02 17:13 
GeneralRe: Call OnInitialUpdate() when u are using CFormView Pin
Shaun Wilde8-Aug-02 10:28
Shaun Wilde8-Aug-02 10:28 
yes this could be useful to add - when I created this class (for a 16bit project ~ '95)I wasn't using CFormViews as the views in the splitters and thus I never noticed it was required - or maybe it is new to the 32 bit environment.

Stupidity dies.
The end of future offspring.
Evolution wins.
- A Darwin Awards Haiku


GeneralReplaceView error !!! Pin
nvhoang13-Mar-02 2:12
nvhoang13-Mar-02 2:12 
GeneralRe: ReplaceView error !!! Pin
Shaun Wilde8-Aug-02 10:24
Shaun Wilde8-Aug-02 10:24 
Generalwhy not send WM_INITIALUPDATE to the new view Pin
salinas25-Dec-01 18:06
salinas25-Dec-01 18:06 
GeneralPreventing splitterbar movement past a postion Pin
TBiker10-Dec-01 11:23
TBiker10-Dec-01 11:23 
GeneralRe: Preventing splitterbar movement past a postion Pin
12-Feb-02 11:46
suss12-Feb-02 11:46 
GeneralThankx Pin
26-Nov-01 1:46
suss26-Nov-01 1:46 
QuestionHow can I use SCROLL BARS with your Class Pin
30-Jun-01 10:18
suss30-Jun-01 10:18 
GeneralCongratulation Pin
24-May-01 11:42
suss24-May-01 11:42 
GeneralSWSplit Pin
20-May-01 6:18
suss20-May-01 6:18 
GeneralRe: SWSplit Pin
SAWilde15-Jun-01 3:26
SAWilde15-Jun-01 3:26 
GeneralRe: SWSplit Pin
Jeason Zhao18-Jun-01 20:15
Jeason Zhao18-Jun-01 20:15 
GeneralRe: SWSplit Pin
SAWilde18-Jun-01 21:49
SAWilde18-Jun-01 21:49 
GeneralChanging bitmaps Pin
18-Apr-01 19:05
suss18-Apr-01 19:05 
GeneralRe: Changing bitmaps Pin
SAWilde15-Jun-01 3:26
SAWilde15-Jun-01 3:26 
General3 panes Pin
Dora11-Jul-00 5:12
Dora11-Jul-00 5:12 
GeneralRe: 3 panes Pin
Shaun Wilde11-Jul-00 9:05
Shaun Wilde11-Jul-00 9:05 
GeneralProblem Pin
sdfsdfasdasd5-Jun-00 8:55
sdfsdfasdasd5-Jun-00 8:55 

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

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