Re: Layout Problem
The CSize parameters passed to CSplitterWnd::CreateView are useless because
the splitter must resize itself to match the main window interior size.
What you should do is replace CSplitterWnd with a class you derive from
CSplitterWnd. Handle the WM_SIZE message in your derived class. Your OnSize
message handler should resize each pane using GetRowInfo/SetRowInfo and
GetColInfo/SetColInfo, then call RecalcLayout. And watch out: OnSize is
called even before the child view's exist, so use a check such as
GetSafeHwnd() to make sure they exist before calling them.
To make the sizes unchangeable by the user your splitter-derived class can
handle WM_LBUTTONDOWN, WM_LBUTTONUP and WM_SETCURSOR. Do not call the base
class handler for these messages: That will make the splitter ignore the
mouse operations.
--
Scott McPhillips [VC++ MVP]
"97612" <97612@discussions.microsoft.com> wrote in message
news:D25A7B3D-74DB-4CDC-8EDD-542DFCD4BA00@microsoft.com...
I create a SDI with six views as followings:
// ************** code **************
CRect rect;
GetClientRect(&rect);
m_wndSplitter.CreateStatic(this, 2, 1);
m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CPreView), CSize(550, 200),
pContext);
m_wndSplitter2.CreateStatic( &m_wndSplitter, 1, 2, WS_CHILD | WS_VISIBLE,
m_wndSplitter.IdFromRowCol(1,0) );
m_wndSplitter2.CreateView(0, 1, RUNTIME_CLASS(CSyncView), CSize(150, 400),
pContext);
m_wndSplitter3.CreateStatic( &m_wndSplitter2, 2, 2, WS_CHILD | WS_VISIBLE,
m_wndSplitter2.IdFromRowCol(0,0) );
m_wndSplitter3.CreateView(0, 0, RUNTIME_CLASS(CBrowserView),
CSize(200,200), pContext);
m_wndSplitter3.CreateView(0, 1, RUNTIME_CLASS(CThumbView), CSize(200,200),
pContext);
m_wndSplitter3.CreateView(1, 0, RUNTIME_CLASS(CRSSView), CSize(200,200),
pContext);
m_wndSplitter3.CreateView(1, 1, RUNTIME_CLASS(CRSSThumbView),
CSize(200,200), pContext);
// ************** code **************
but I want to keep every view in fixed size. For example, I want
CThumbView
to display as 200x200, and the sides of CThumbView can't be moved. But I
got
two problem. I don't know how to fix the sides. Second one is that after I
set up the value as above, the CThumbView doesn't show up as 200x200 when
my
program starts. Any suggestions? Thanks.