Restricting the size of a splitter pane
Posted
by Sesame Sesame
on March 24th, 1999
- First derive class XSplitterWnd from CSplitterWnd,
- Then handle the WM_ONSIZE,call the SetColInfo() and SetRowInfo() in OnSize function.
- And handle the WM_MOUSEMOVE and WM_SETCURSOR to prevent user from changing size.
void XSplitterWnd::OnSize(UINT nType, int cx, int cy)
{
RECT rect;
int Height;
GetClientRect( &rect );
Height = rect.bottom - rect.top - 36;
if ( m_pRowInfo != NULL )
if ( Height < 0 )
SetRowInfo( 0, 1, 1);
else
SetRowInfo( 0, Height, Height );
CSplitterWnd::OnSize(nType, cx, cy);
// TODO: Add your message handler code here
}
void XSplitterWnd::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
//CSplitterWnd::OnMouseMove(nFlags, point);
}
void XSplitterWnd::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
//CSplitterWnd::OnLButtonDown(nFlags, point);
}
BOOL XSplitterWnd::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
// TODO: Add your message handler code here and/or call default
//return CSplitterWnd::OnSetCursor(pWnd, nHitTest, message);
return FALSE;
}
Any comments and suggests, please let me know.
Regards, Sesame
Date Last Updated: March 24, 1999

Comments
How to Restrict the splitter from being moved after a particular size
Posted by Legacy on 11/30/2002 12:00amOriginally posted by: Muthukumar K.
Hi Guys,
As a whole I have learnt a lot from codeguru. Its really a GURU (teacher in Sanskrit).
As a need, I have to restrict the splitter from being resized after the pane of a splitter window(two panes) has reached a particular size (on either side i.e. left as well as right side).
Could you suggest a method ? I tried using many options but it didn't work out for me.
Bye & Thanks
Replyhelp! How to do??
Posted by Legacy on 11/01/2002 12:00amOriginally posted by: zhangsifang
I want to do splitter windows:
________________________
| | |
| | |
| | |
| | |
________________________
| |
| |
| |
________________________
How to do ? email to me zhangsifang@163.net Thanks!
ReplyMore simple method. Just one line...
Posted by Legacy on 10/29/2002 12:00amOriginally posted by: JoonKyu Choi
Use....
m_SplitterWnd.EnableWindw(false)
Replystatic splitter...need help!!!
Posted by Legacy on 10/29/2002 12:00amOriginally posted by: Paulo
i need to do a static splitter with 2 view, one to draw and another with scrooll to display the images i draw in the first view...
ReplyA quick way
Posted by Legacy on 11/11/2001 12:00amOriginally posted by: Shaun
Just override WM_NCHITTEST message, from your derived CSplitterWnd class, then I add a member variable called m_bLock, and the following functions:
// public
void CSplitterWndEx::Lock( BOOL bLock )
{
m_bLock = bLock;
}
// override the WM_NCHITTEST message
UINT CSplitterWndEx::OnNcHitTest( CPoint point )
{
if( m_bLock )
return HTNOWHERE; // if locked
return CSplitterWnd::OnNcHitTest( point );
}
Also remember to init m_bLock with a default from the contructor, after creating your splitter and views, call
m_wndSplitterWnd.Lock( TRUE ); // to lock splitter
Have fun...
Regards
Shaun
ReplyIt was not Influenced Window..
Posted by Legacy on 04/09/2001 12:00amOriginally posted by: Donbu
I was Implement CXSplitterWnd And Test That.
But CXSplitterWnd Class was not Influence to the Window..
They were moved and Resize by mouse Click...
and.... They can't Set Size Because GetClientRect(&rect)
may be set the rect struct at all value is 0..
my English Avility is not so good... But...
this Example is so Strange... (I wanna use none-Resize Splitter....)
If Anyone knows this Problem.... Please to Teach me by
E-Mail ....
My Address : donbu_com@hanmail.net
ReplyHow can I derive new class from CSplitterWnd ?
Posted by Legacy on 02/16/2001 12:00amOriginally posted by: Namkyeong Lee
I couldn't find CSplitterWnd in Base Class section of New Class Wizard...
How can I do this??
ReplyGetClientRect needs ?
Posted by Legacy on 02/24/2000 12:00amOriginally posted by: Denis Flotat
I can't understand the need for GetClientRect function because it always Zero-initialize RECT structure.
ReplySo pane index 0 is always the default size !!!
VC 6.0 problems
Posted by Legacy on 04/06/1999 12:00amOriginally posted by: Eric Hammond
It was a real fight to get VC 6.0 to support CSplitterWnd at all.
I finally got the message support, but the splitter is still re-sizeable.
What am I missing?
Thanks
ReplyEric