CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 1999
    Posts
    3

    unchangeable splitter pan

    How can I set unchangeable splitter pane?

    CiMan
    [email protected]


  2. #2
    Join Date
    Jul 1999
    Location
    Islamabad, Pakistan.
    Posts
    25

    Re: unchangeable splitter pan

    Basic concept of splitter windows is to have resizable panes.
    But dont know what to do the way you want them to be!


  3. #3
    Join Date
    Aug 1999
    Posts
    3

    Re: re- unchangeable size of splitter panes

    I found the right solution
    for implementation re- unchangeable size of splitter panes.
    It is useful to know.
    Sometimes it is needed.

    Use instead of CSplitterWnd
    class CSplitterWndNRS (NoReSizeable)

    class CSplitterWndNRS : public CSplitterWnd
    {
    public:
    virtual int HitTest(CPoint pt) const {return 0;};
    };

    CiMan
    [email protected]



  4. #4
    Guest

    Re: re- unchangeable size of splitter panes

    Hi,
    I am also looking for the same. But can u put some more light on it. Actually, I have one splitter window with 3 rows and 1 column and i want to avoide resizing through mouse. Pl let me at the earliest.
    thanks
    yash


  5. #5
    Join Date
    May 1999
    Posts
    19

    Re: unchangeable splitter pan

    Derive a class from CSplitterWnd. In your header file, put


    BOOL m_bLockedSplBars;

    inline void SetSplBarLock(const BOOL bLocked) {m_bLockedSplBars = bLocked;}
    inline BOOL GetSplBarLock() const {return m_bLockedSplBars;}




    Use the class wizard to make handlers for WM_LBUTTONDOWN, WM_MOUSEMOVE, and WMSETCURSOR. In the cpp file, add code to the handlers as below.


    // --------------------------------------------------------------------------
    void CSplWndFixed::OnLButtonDown(UINT nFlags, CPoint point)
    {
    if (m_bLockedSplBars)
    { // CWnd doesn't do splitter bars.
    CWnd::OnLButtonDown(nFlags, point);
    }
    else
    { // CSplitterWnd handles splitter bars.
    CSplitterWnd::OnLButtonDown(nFlags, point);
    }
    }


    // --------------------------------------------------------------------------
    void CSplWndFixed::OnMouseMove(UINT nFlags, CPoint point)
    {
    if (m_bLockedSplBars)
    { // CWnd doesn't do splitter bars.
    CWnd::OnMouseMove(nFlags, point);
    }
    else
    { // CSplitterWnd handles splitter bars.
    CSplitterWnd::OnMouseMove(nFlags, point);
    }
    }


    // --------------------------------------------------------------------------
    BOOL CSplWndFixed::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
    {
    if (m_bLockedSplBars)
    { // CWnd doesn't do splitter bars.
    return CWnd::OnSetCursor(pWnd, nHitTest, message);
    }
    else
    { // CSplitterWnd handles splitter bars.
    return CSplitterWnd::OnSetCursor(pWnd, nHitTest, message);
    }
    }




    Initialize m_bLockedSplBars in your constructor or elsewhere.

    More info can be found in The MFC Answer Book, by Eugene Kain, Addison Wesley

    Details of how CSplitterWnd works are in MFC Internals, by George Shepard and Scot Wingo, Addison Wesley.




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured