Click here to Skip to main content
15,891,513 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

 
QuestionUse CUsefulSplitterWnd in MDI ? Pin
jensreichert30-Mar-03 6:17
jensreichert30-Mar-03 6:17 
AnswerRe: Use CUsefulSplitterWnd in MDI ? Pin
Shaun Wilde30-Mar-03 21:29
Shaun Wilde30-Mar-03 21:29 
GeneralRe: Use CUsefulSplitterWnd in MDI ? Pin
jensreichert31-Mar-03 1:05
jensreichert31-Mar-03 1:05 
GeneralRe: Use CUsefulSplitterWnd in MDI ? Pin
Shaun Wilde31-Mar-03 1:17
Shaun Wilde31-Mar-03 1:17 
GeneralRe: Use CUsefulSplitterWnd in MDI ? Pin
jensreichert31-Mar-03 6:06
jensreichert31-Mar-03 6:06 
AnswerRe: Use CUsefulSplitterWnd in MDI ? Pin
The_Neti15-Dec-04 22:39
The_Neti15-Dec-04 22:39 
QuestionHow to make SetFocus? Pin
yummi15-Jan-03 8:29
yummi15-Jan-03 8:29 
AnswerRe: How to make SetFocus? Pin
Shaun Wilde17-Jan-03 8:14
Shaun Wilde17-Jan-03 8:14 
I think its all related to how MFC does its printing - I think by default it will print the first view in its list of views - what you have to do is override this default mechanism and make it print the second view instead - I think there is a command message you can intercept ID_FILE_PRINT that may help you

Technically speaking the dictionary would define Visual Basic users as programmers.
But here again, a very generalized, liberal definition is being employed and it's wrong
- just plain wrong - Tom Archer 5/12/02


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 
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 

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.