Restricting the size of a splitter pane

WEBINAR: On-demand webcast

How to Boost Database Development Productivity on Linux, Docker, and Kubernetes with Microsoft SQL Server 2017 REGISTER >

I find the solution about restrict the size of the pane.
    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:00am

    Originally 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

    Reply
  • help! How to do??

    Posted by Legacy on 11/01/2002 12:00am

    Originally posted by: zhangsifang

    I want to do splitter windows:
    ________________________
    | | |
    | | |
    | | |
    | | |
    ________________________
    | |
    | |
    | |
    ________________________

    How to do ? email to me zhangsifang@163.net Thanks!

    Reply
  • More simple method. Just one line...

    Posted by Legacy on 10/29/2002 12:00am

    Originally posted by: JoonKyu Choi

    Use....

    m_SplitterWnd.EnableWindw(false)

    Reply
  • static splitter...need help!!!

    Posted by Legacy on 10/29/2002 12:00am

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

    Reply
  • A quick way

    Posted by Legacy on 11/11/2001 12:00am

    Originally 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

    Reply
  • It was not Influenced Window..

    Posted by Legacy on 04/09/2001 12:00am

    Originally 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

    Reply
  • How can I derive new class from CSplitterWnd ?

    Posted by Legacy on 02/16/2001 12:00am

    Originally posted by: Namkyeong Lee

    I couldn't find CSplitterWnd in Base Class section of New Class Wizard...

    How can I do this??

    Reply
  • GetClientRect needs ?

    Posted by Legacy on 02/24/2000 12:00am

    Originally posted by: Denis Flotat

    I can't understand the need for GetClientRect function because it always Zero-initialize RECT structure.
    So pane index 0 is always the default size !!!

    Reply
  • VC 6.0 problems

    Posted by Legacy on 04/06/1999 12:00am

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

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • As all sorts of data becomes available for storage, analysis and retrieval - so called 'Big Data' - there are potentially huge benefits, but equally huge challenges...
  • The agile organization needs knowledge to act on, quickly and effectively. Though many organizations are clamouring for "Big Data", not nearly as many know what to do with it...
  • Cloud-based integration solutions can be confusing. Adding to the confusion are the multiple ways IT departments can deliver such integration...

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date