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.3K   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: 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 
GeneralRe: How to make SetFocus? Pin
yummi17-Jan-03 9:06
yummi17-Jan-03 9:06 
Hi
First of all thank you for your answer.
I noticed the following: when I don't click on the second pane (view) and I changed the view by clicking on another item in the first pane the algorithm set always the new view as active.
When I click in the view pane and after I do this I click in the first pane to change the view, the ActivateView function will not be called, because of that the printing message receives in the first pane (the selecting area).
I make the following changes in the function ReplaceView:
<br />
if (pActiveView==NULL || pActiveView==GetPane(row,col))<br />
    bSetActive=TRUE;<br />
else<br />
    bSetActive=TRUE;//FALSE;<br />

so that bSetActive always be TRUE (I show it on that way so that you can find it on your code)
Because of that here
<br />
if (bSetActive==TRUE)<br />
      GetParentFrame()->SetActiveView(pNewView);      <br />

the new View always get the active part.

I don't know if there is any secondary effect on your algorithm?

I Hope you understood whatv I mean.
Thanks
yummi
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 
GeneralRe: SWSplit Pin
Jeason Zhao18-Jun-01 20:15
Jeason Zhao18-Jun-01 20:15 

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.