Click here to Skip to main content
15,881,455 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 384.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

 
GeneralOnInitialUpdate Pin
hellogany25-Apr-10 20:49
hellogany25-Apr-10 20:49 
GeneralRe: OnInitialUpdate Pin
Shaun Wilde27-Apr-10 1:34
Shaun Wilde27-Apr-10 1:34 
GeneralUse of ReplaceView from Inside of worker thread generate crasing. Pin
Le@rner13-Oct-09 19:03
Le@rner13-Oct-09 19:03 
GeneralRe: Use of ReplaceView from Inside of worker thread generate crasing. Pin
Shaun Wilde14-Oct-09 8:18
Shaun Wilde14-Oct-09 8:18 
GeneralRe: Use of ReplaceView from Inside of worker thread generate crasing. Pin
Le@rner14-Oct-09 18:10
Le@rner14-Oct-09 18:10 
GeneralRe: Use of ReplaceView from Inside of worker thread generate crasing. Pin
Shaun Wilde15-Oct-09 8:28
Shaun Wilde15-Oct-09 8:28 
GeneralOnInitialUpdate Function not working after replacing view. Pin
Le@rner3-Apr-08 19:12
Le@rner3-Apr-08 19:12 
GeneralRe: OnInitialUpdate Function not working after replacing view. Pin
sheeba.ph16-Jun-08 19:59
sheeba.ph16-Jun-08 19:59 
GeneralRe: OnInitialUpdate Function not working after replacing view. Pin
Shaun Wilde17-Jun-08 8:50
Shaun Wilde17-Jun-08 8:50 
AnswerRe: OnInitialUpdate Function not working after replacing view. Pin
Aletheuein10-Aug-08 4:04
Aletheuein10-Aug-08 4:04 
AnswerRe: OnInitialUpdate Function not working after replacing view. Pin
wct7-Jan-09 19:22
wct7-Jan-09 19:22 
GeneralRe: OnInitialUpdate Function not working after replacing view. Pin
Shaun Wilde7-Jan-09 20:34
Shaun Wilde7-Jan-09 20:34 
GeneralRe: OnInitialUpdate Function not working after replacing view. Pin
wct10-Jan-09 4:13
wct10-Jan-09 4:13 
GeneralRe: OnInitialUpdate Function not working after replacing view. Pin
Víctor Rodriguez-Doncel17-Jul-09 4:07
Víctor Rodriguez-Doncel17-Jul-09 4:07 
GeneralSplit it into more parts [modified] Pin
neha.agarwal2716-Nov-06 20:15
neha.agarwal2716-Nov-06 20:15 
GeneralRe: Split it into more parts Pin
Shaun Wilde17-Nov-06 8:56
Shaun Wilde17-Nov-06 8:56 
GeneralCFormView from a DLL Pin
Ajay L D5-Nov-06 18:26
Ajay L D5-Nov-06 18:26 
GeneralRe: CFormView from a DLL Pin
Shaun Wilde17-Nov-06 8:53
Shaun Wilde17-Nov-06 8:53 
GeneralCSplitterWnd in SDI Pin
Bhushan19806-Jul-06 20:36
Bhushan19806-Jul-06 20:36 
Hi all,
This is my first email to this site. I have developed an SDI application with Wizard type propertypages and it builds and runs without any errors. Now I want to store the data obtained from the Wizard pages into some database object and display it in a list control on the formview. So I want to introduce 3 vertical panes into my main view class provided by the framework, which I know how to do and I am aware of the procedure of assigning various views to the different panes. What I want to know is how to dynamically change the views in the middle view say 1,2,3 using a treectrl(Left pane which is fixed) or mainmenu command? The RHS view is CRichEditView and that too is fixed. So if I want to use DAO database where shall I declare the objects and variables then? Obviously I can post that question to the database forums, but since it is related I am asking it here. I just need the appropriate space where I should declare and define them. I also understand that using a split view, it is better to use CMainFrame class to handle the messages or menu commands. Also, are there any changes to be made to the relevant view classes after adding the split window? That is all I need right now......

Thank you all in advance.....

Regards

Bhushan.
GeneralRe: CSplitterWnd in SDI Pin
Shaun Wilde6-Jul-06 21:03
Shaun Wilde6-Jul-06 21:03 
QuestionHow to create a PaneView, the Form is in a DLL. Pin
HFHero.William28-May-06 20:10
HFHero.William28-May-06 20:10 
AnswerRe: How to create a PaneView, the Form is in a DLL. Pin
Shaun Wilde29-May-06 0:35
Shaun Wilde29-May-06 0:35 
GeneralRe: How to create a PaneView, the Form is in a DLL. [modified] Pin
HFHero.William29-May-06 5:55
HFHero.William29-May-06 5:55 
GeneralRe: How to create a PaneView, the Form is in a DLL. [modified] Pin
Shaun Wilde29-May-06 9:06
Shaun Wilde29-May-06 9:06 
GeneralRe: How to create a PaneView, the Form is in a DLL. [modified] Pin
HFHero.William29-May-06 17:15
HFHero.William29-May-06 17: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.