Click to See Complete Forum and Search --> : unchangeable splitter pan


CiMan
August 6th, 1999, 08:21 AM
How can I set unchangeable splitter pane?

CiMan
ok@hotmail.com

Aamer Munir
August 6th, 1999, 09:05 AM
Basic concept of splitter windows is to have resizable panes.
But dont know what to do the way you want them to be!

CiMan
August 6th, 1999, 01:06 PM
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
ok@aquanet.co.il

August 6th, 1999, 04:07 PM
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

Mark Messer
August 6th, 1999, 10:33 PM
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.