Determine the row and column of a view

CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

This method will tell you where on the split window this view is located (row and column).

void CMySplitterView::GetRowCol(int &row, int & col)
{
	CSplitterWnd * parent;
	parent = (CSplitterWnd*)GetParent();
	int rows;
	int cols;
	rows = parent->GetRowCount();
	cols = parent->GetColumnCount();
	for(row = 0; row < rows; row++)
	{
		for(col = 0; col < cols; col++)
		{
			if(this == parent->GetPane(row,col))
			{
				return;
			}
		}
	}
	ASSERT(TRUE == FALSE);
}

More by Author

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Must Read