Click here to Skip to main content
15,885,996 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.6K   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: I don't want to destroy existed view(formview) [modified] Pin
ZeugmaBarter26-May-06 11:36
ZeugmaBarter26-May-06 11:36 
GeneralRe: I don't want to destroy existed view(formview) [modified] Pin
Shaun Wilde29-May-06 0:37
Shaun Wilde29-May-06 0:37 
QuestionRe: I don't want to destroy existed view(formview) Pin
bilsby27-Mar-08 6:17
bilsby27-Mar-08 6:17 
GeneralRe: I don't want to destroy existed view(formview) Pin
Shaun Wilde28-Mar-08 21:21
Shaun Wilde28-Mar-08 21:21 
GeneralRe: I don't want to destroy existed view(formview) Pin
PRMARJORAM30-Mar-09 3:54
PRMARJORAM30-Mar-09 3:54 
GeneralLittle ehancement Pin
Ratmangg25-Mar-04 23:03
Ratmangg25-Mar-04 23:03 
GeneralThanks Pin
sir kaber25-Dec-03 19:36
sir kaber25-Dec-03 19:36 
GeneralPrint & Print Preview with a splitter window Pin
WayneRC22-Sep-03 5:32
WayneRC22-Sep-03 5:32 
Hi,

I've got an SDI app with a splitter, but as soon as I override OnCreateClient in CMainFrame (returning TRUE instead of CFrameWnd::OnCreateClient(...)) I completely lose printing support. I see that CFrameWnd::OnCreateClient creates a view which I guess I need to enable printing support.

Any ideas on how I can get round this cos I wanted to have my app print a custom report, but I don't get "free printing" now!

Thanks in advance Smile | :)

Life would be a lot easier if I had the source code...
GeneralRe: Print & Print Preview with a splitter window Pin
Shaun Wilde22-Sep-03 10:31
Shaun Wilde22-Sep-03 10:31 
GeneralRe: Print & Print Preview with a splitter window Pin
WayneRC22-Sep-03 22:27
WayneRC22-Sep-03 22:27 
GeneralRe: Print & Print Preview with a splitter window Pin
Shaun Wilde22-Sep-03 22:50
Shaun Wilde22-Sep-03 22:50 
GeneralRe: Print & Print Preview with a splitter window Pin
WayneRC22-Sep-03 23:01
WayneRC22-Sep-03 23:01 
Generalhide the split bar Pin
ykuang10-Sep-03 23:26
ykuang10-Sep-03 23:26 
GeneralRe: hide the split bar Pin
Shaun Wilde11-Sep-03 7:50
Shaun Wilde11-Sep-03 7:50 
GeneralRe: hide the split bar Pin
qcha0s20-Aug-04 5:27
qcha0s20-Aug-04 5:27 
GeneralRe: hide the split bar Pin
Shaun Wilde22-Aug-04 6:19
Shaun Wilde22-Aug-04 6:19 
GeneralRe: hide the split bar Pin
qcha0s2-Sep-04 8:16
qcha0s2-Sep-04 8:16 
GeneralRe: hide the split bar Pin
Shaun Wilde2-Sep-04 9:50
Shaun Wilde2-Sep-04 9:50 
GeneralRe: hide the split bar Pin
qcha0s3-Sep-04 4:37
qcha0s3-Sep-04 4:37 
GeneralThanks so much Pin
Radha Nair2-Jul-03 21:03
Radha Nair2-Jul-03 21:03 
QuestionInsert CPropertySheet in SplitterWnd? How? Pin
jensreichert24-Apr-03 22:30
jensreichert24-Apr-03 22:30 
AnswerRe: Insert CPropertySheet in SplitterWnd? How? Pin
Shaun Wilde24-Apr-03 23:03
Shaun Wilde24-Apr-03 23:03 
GeneralPbm with FormViews Pin
Anonymous9-Apr-03 19:00
Anonymous9-Apr-03 19:00 
GeneralRe: Pbm with FormViews Pin
Shaun Wilde9-Apr-03 21:19
Shaun Wilde9-Apr-03 21:19 
QuestionUse CUsefulSplitterWnd in MDI ? Pin
jensreichert30-Mar-03 6:17
jensreichert30-Mar-03 6:17 

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.