Moving a CSplitterWnd sash
Dwayne Schultz -- DSchultz@dataware.com
Tuesday, April 16, 1996
Platform: VC 4.1 & Win95/WinNT
I have a splitter with two views, one on top of the other. The top view
is the important view that should take up the larger portion of the
screen. The bottom view is a CFormView with a couple of controls in it.
When the user resizes the frame, I would like the bottom view to stay the
same size. I think what I want to do is tell the CSplitterWnd to change
the sash position in the frame's OnSize handler. If that is the
solution, I can't figure out how to 'tell' the CSplitterWnd. Has anyone
done this?
Dwayne
Stevko Elemir -- STEVKO@dcse.fee.vutbr.cz
Friday, April 19, 1996
I have used the following code to set the column width
in the splitter window:
class CMySplitterFrame : public CMDIChildWnd
{
...
protected:
CMySplitter m_wndSplitter;
public:
void SetColumnWidth(int col, int cxWidth);
...
}
void CSplitterFrame::SetColumnWidth(int col, int cxWidth)
{
int cxOldWidth, cxOldMinWidth;
m_wndSplitter.GetColumnInfo(col,cxOldWidth,cxOldMinWidth);
m_wndSplitter.SetColumnInfo(col,cxWidth,cxOldMinWidth);
m_wndSplitter.RecalcLayout();
}
If you replace GetColumnInfo() by GetRowInfo() and SetColumnInfo()
by SetRowInfo() it should work for rows too.
Elemir Stevko
stevko@dcse.fee.vutbr.cz
----------
From: Dwayne Schultz[SMTP:DSchultz@dataware.com]
Sent: 17. IV 1996 0:38
To: 'MFC List'
Subject: Moving a CSplitterWnd sash
Platform: VC 4.1 & Win95/WinNT
I have a splitter with two views, one on top of the other. The top view
is the important view that should take up the larger portion of the
screen. The bottom view is a CFormView with a couple of controls in it.
When the user resizes the frame, I would like the bottom view to stay the
same size. I think what I want to do is tell the CSplitterWnd to change
the sash position in the frame's OnSize handler. If that is the
solution, I can't figure out how to 'tell' the CSplitterWnd. Has anyone
done this?
Dwayne
Niels Ull Jacobsen -- nuj@kruger.dk
Saturday, April 20, 1996
At 22:38 16-04-96 edt, you wrote:
>
>Platform: VC 4.1 & Win95/WinNT
>
>I have a splitter with two views, one on top of the other. The top view=
=20
>is the important view that should take up the larger portion of the =20
>screen. The bottom view is a CFormView with a couple of controls in it.
>
>When the user resizes the frame, I would like the bottom view to stay th=
e =20
>same size. I think what I want to do is tell the CSplitterWnd to change=
=20
>the sash position in the frame's OnSize handler. If that is the =20
>solution, I can't figure out how to 'tell' the CSplitterWnd. Has anyone=
=20
>done this?
No, but I have a few ideas. Set the ideal size of the top pane to a very
large number
and the minimum size of the bottom pane to whatever is needed for your fo=
rm view
(use MapDialogRect() or GetDialogBaseUnits() to find out). This should
ensure that the top pane will always expand to fill as much as possible.
Or make the lower pane a CDialogBar instead.
=20
>
>Dwayne =20
>
>
>
Niels Ull Jacobsen, Kr=FCger A/S (nuj@kruger.dk)
Everything stated herein is THE OFFICIAL POLICY of the entire Kruger grou=
p
and should be taken as legally binding in every respect. Pigs will grow
wings and fly.
| Вернуться в корень Архива
|