Re: Splitter problem

From: Michael K. O'Neill (mikeathon2000_at_nospam.hotmail.com)
Date: 10/24/04


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



Relevant Pages

  • Re: missing commas when saving excel as CSV
    ... > I have a very strange symptom that occurs when saving a CSV file from excel. ... > entered into the first column but not the second. ... > CSV, the first row obviously has a comma between the two values, and the ... the 16th and subsequent rows have no comma. ...
    (microsoft.public.excel.misc)
  • RE: Formula Help
    ... This assumes you output table starts in A1 with labels in the first column ... and first row. ... without adding the order quanities as would happen with pivot table. ... is there a better route to manipulate this data? ...
    (microsoft.public.excel.misc)
  • Re: Copy data from Excel (Ctrl+C) text number
    ... If the first row first column in excel is numeric, and the rest in the first ... Access has much stronger datatyping than Excel. ...
    (microsoft.public.access.forms)
  • Re: SUM of certain cells after Autofilter
    ... Where are you putting the SUBTOTAL formula? ... Try inserting a row above your first row and putting the formula there. ... adjhust range to suit ... After Autofilter regarding x in any column the sum of VISIBLE cells with the value 2 should be calculated (e.g. 2 for the first column and 4 for the second one). ...
    (microsoft.public.excel)
  • Re: CSplitterWnd problem
    ... > split the first row again, into 2 columns, the resulting panes don't ... But I do set a size when I create a pane. ... (Or into the main splitter, if you are using a derived ... OnSize is called when the user resizes the frame. ...
    (microsoft.public.vc.mfc)

Loading