Re: Splitter problem
From: Michael K. O'Neill (mikeathon2000_at_nospam.hotmail.com)
Date: 10/24/04
- Next message: Dave: "Dialog based problem in vc6"
- Previous message: Joseph M. Newcomer: "Re: Resource File does save WideChar ?"
- In reply to: Roger Pearse: "Splitter problem"
- Next in thread: Roger Pearse: "Re: Splitter problem"
- Reply: Roger Pearse: "Re: Splitter problem"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 24 Oct 2004 11:14:19 -0700
You're correct that m_wndSplitter.IdFromRowCol(0, 0) would refer to the
first row and the first column.
But I think your assertion is caused by the fact that the first row/column
has a view assigned to it already. Tell us what the assert is, and where
it's coming from.
If you would tell us what you would like your view to look like, we might be
able to suggest code. For example, the following code, which is from
CChildFrame::OnCreateClient, will make one vertical column on the left, and
two rows one over the other on the right, such that your view looks like
this:
----------------
| | |
| |-------|
| | |
---------------
(Sorry for proportional/fixed font issues)
BOOL CChildFrame::OnCreateClient( LPCREATESTRUCT /*lpcs*/,
CCreateContext* pContext)
{
// create vertical splitter window first
if ( !m_wndSplitterVert.CreateStatic(this, 1, 2) )
return FALSE;
// now create horizontal splitter window inside right-hand pane of vertical
splitter
if ( !m_wndSplitterHoriz.CreateStatic( &m_wndSplitterVert, // our parent
window is the first splitter
2, 1, // the new splitter is 2 rows by 1 column
WS_CHILD | WS_VISIBLE | WS_BORDER, // style, WS_BORDER is needed
m_wndSplitterVert.IdFromRowCol(0, 1) ) ) // new splitter is in the
first row, second column of main splitter
return FALSE;
// set up target sizes for the windows
// overall, the window area of the frame should be around two-thirds of the
// available area on the screen
int cx = ::GetSystemMetrics(SM_CXSCREEN);
int cy = ::GetSystemMetrics(SM_CYSCREEN);
int cyNonClient = ::GetSystemMetrics(SM_CYCAPTION) +
2*::GetSystemMetrics(SM_CYMENU);
cx = (int) (.667*cx);
cy = (int) (.667*cy);
// insert views into panes, with desired sizes
// left-hand pane should be around one-fourth of view area
// vertical splitter first ....
if ( !m_wndSplitterVert.CreateView(0, 0,
RUNTIME_CLASS(CWebScraperSitesView), CSize( (int)(0.25*cx),
cy-cyNonClient ), pContext) )
{
m_wndSplitterVert.DestroyWindow();
m_wndSplitterHoriz.DestroyWindow();
return FALSE;
}
// ... then horizontal splitter on right-hand side of vertical splitter
// top pane (the request) around one-quarter of available area
if ( !m_wndSplitterHoriz.CreateView(0, 0,
RUNTIME_CLASS(CWebScraperRequestView), CSize( (int)(0.75*cx),
(int)(0.25*cy)-cyNonClient ), pContext) ||
!m_wndSplitterHoriz.CreateView(1, 0, RUNTIME_CLASS(CWebScraperReplyView),
CSize( (int)(0.75*cx), (int)(0.75*cy)-cyNonClient ), pContext) )
{
m_wndSplitterVert.DestroyWindow();
m_wndSplitterHoriz.DestroyWindow();
return FALSE;
}
return TRUE;
}
>
"Roger Pearse" <roger_pearse@yahoo.co.uk> wrote in message
news:3a88eeea.0410231508.d26de81@posting.google.com...
> I'm just starting to experiment with the MFC, and was looking at the
> VIEWEX sample, and the three-way splitter.
>
> If I alter this:
>
> // add the second splitter pane - which is a nested splitter with 2
> rows
> if (!m_wndSplitter2.CreateStatic(
> &m_wndSplitter, // our parent window is the first splitter
> 2, 1, // the new splitter is 2 rows, 1 column
> WS_CHILD | WS_VISIBLE | WS_BORDER, // style, WS_BORDER is needed
> m_wndSplitter.IdFromRowCol(0, 1)
> // new splitter is in the first row, 2nd column of first splitter
> ))
> {
> TRACE0("Failed to create nested splitter\n");
> return FALSE;
> }
>
> and change the splitter so that it splits the first column, not the
> second:
>
> m_wndSplitter.IdFromRowCol(0, 0)
>
> I get an assertion failure.
>
> I realise I must be doing something wrong in a very basic way, but I
> would really be grateful if someone could tell me what I'm doing
> wrong. If 0, 1 = row 0, col 1, then why isn't 0,0 = row 0 col 0?
>
> All the best,
>
> Roger Pearse
- Next message: Dave: "Dialog based problem in vc6"
- Previous message: Joseph M. Newcomer: "Re: Resource File does save WideChar ?"
- In reply to: Roger Pearse: "Splitter problem"
- Next in thread: Roger Pearse: "Re: Splitter problem"
- Reply: Roger Pearse: "Re: Splitter problem"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|