Click here to Skip to main content
15,895,084 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: PVOID pBuffer; access to data :confused: Pin
Dave Harper8-Oct-03 11:36
Dave Harper8-Oct-03 11:36 
GeneralRe: PVOID pBuffer; access to data :confused: Pin
ZoogieZork8-Oct-03 12:43
ZoogieZork8-Oct-03 12:43 
GeneralRe: PVOID pBuffer; access to data :confused: Pin
Dave Harper8-Oct-03 13:07
Dave Harper8-Oct-03 13:07 
QuestionConsole c++ global class? Pin
immanis8-Oct-03 7:06
immanis8-Oct-03 7:06 
AnswerRe: Console c++ global class? Pin
Ryan_Roberts8-Oct-03 7:14
Ryan_Roberts8-Oct-03 7:14 
GeneralRe: Console c++ global class? Pin
immanis8-Oct-03 18:03
immanis8-Oct-03 18:03 
AnswerRe: Console c++ global class? Pin
David Crow8-Oct-03 8:17
David Crow8-Oct-03 8:17 
GeneralSplitter Window Control Pin
Lea Hayes8-Oct-03 6:39
Lea Hayes8-Oct-03 6:39 
Hi,

I have created my own splitter window control, I then added all of the functionality from an article on CodeProject which enables me to show/hide columns and rows. However some of the assertion errors seem to be causing me problems.

Would you be able to see what the problem could be?

// from Header file...<br />
<br />
// CViewSplitter<br />
<br />
class CViewSplitter : public CSplitterWnd<br />
{<br />
...<br />
	typedef std::list<int> LIST_INT;<br />
<br />
	bool MaximizeActiveView();<br />
	void RestoreViews();<br />
	bool MaximizeView(int row, int col);<br />
<br />
	void HideColumn(int colHide);<br />
	void ShowColumn(int colShow);<br />
	void HideRow(int colRow);<br />
	void ShowRow(int row);<br />
...<br />
};<br />
<br />
// from source file (only relevant code)...<br />
<br />
bool CViewSplitter::MaximizeView(int row, int col)<br />
{<br />
	// make sure that the specified column and row are valid<br />
	ASSERT(row <= m_nRows && col <= m_nCols);<br />
<br />
	// say that a view has been maximized<br />
	bMaximized = true;<br />
<br />
	// hide the remaining views<br />
	if(row == 0) HideRow(1); else HideRow(0);<br />
	if(col == 0) HideColumn(1); else HideColumn(0);<br />
<br />
	return true;<br />
}<br />
<br />
void CViewSplitter::RestoreViews()<br />
{<br />
	// say that all of the views have been normalized<br />
	bMaximized = false;<br />
<br />
	// replace in opposite order<br />
	ShowColumn(0); ShowColumn(1);<br />
	ShowRow(0); ShowRow(1);<br />
}<br />
<br />
bool CViewSplitter::MaximizeActiveView()<br />
{<br />
	// find the active pane<br />
	int nActiveRow, nActiveCol;<br />
<br />
	if(GetActivePane(&nActiveRow, &nActiveCol) != NULL)<br />
		return MaximizeView(nActiveRow, nActiveCol);<br />
	else<br />
		return false;<br />
}<br />
<br />
void CViewSplitter::ShowColumn(int col)<br />
{<br />
     ASSERT_VALID(this);<br />
     ASSERT(m_nCols <= m_nMaxCols);<br />
<br />
	std::list<int>::iterator col_pos;  <br />
<br />
	col_pos = std::find(m_shown_cols.begin(),m_shown_cols.end(),col);<br />
	<br />
	if(col_pos!=m_shown_cols.end())<br />
	{<br />
		//ASSERT(0);<br />
		return;<br />
	}<br />
<br />
	int place = AbsToRelPosition(m_shown_cols, col);<br />
<br />
	m_nCols++;  // add a column<br />
	<br />
	m_shown_cols.push_back(col);<br />
	m_shown_cols.sort();<br />
	m_hid_cols.remove(col);<br />
<br />
	RenumeratePanes();<br />
<br />
	RestoreColInfo(place,col);<br />
	RecalcLayout();<br />
}<br />
<br />
void CViewSplitter::HideColumn(int colHide)<br />
{<br />
	ASSERT_VALID(this);<br />
	ASSERT(m_nCols > 1);<br />
	ASSERT(colHide < m_nMaxCols);<br />
<br />
	std::list<int>::iterator col_pos;  <br />
<br />
	col_pos = std::find(m_shown_cols.begin(),m_shown_cols.end(),colHide);<br />
	<br />
	if(col_pos==m_shown_cols.end())<br />
	{<br />
		ASSERT(0);<br />
		return;<br />
	}<br />
<br />
	int place = std::distance(m_shown_cols.begin(),col_pos);<br />
	<br />
	// if the column has an active window -- change it<br />
    int rowActive, colActive;<br />
    if (GetActivePane(&rowActive, &colActive) != NULL &&<br />
         colActive == place)<br />
    {<br />
          if (++colActive >= m_nCols)<br />
              colActive = 0;<br />
          SetActivePane(rowActive, colActive);<br />
    }<br />
<br />
	m_shown_cols.remove(colHide);<br />
	m_hid_cols.push_back(colHide);<br />
<br />
    m_nCols--;<br />
<br />
	RenumeratePanes();<br />
<br />
	RemoveColInfo(place,colHide);<br />
<br />
    RecalcLayout();<br />
}<br />
<br />
void CViewSplitter::HideRow(int rowHide)<br />
{<br />
	ASSERT_VALID(this);<br />
	ASSERT(m_nRows > 1);<br />
	ASSERT(rowHide < m_nMaxRows);<br />
<br />
	std::list<int>::iterator row_pos;  <br />
<br />
	row_pos = std::find(m_shown_rows.begin(),m_shown_rows.end(),rowHide);<br />
	<br />
	if(row_pos==m_shown_rows.end())<br />
	{<br />
		ASSERT(0);<br />
		return;<br />
	}<br />
<br />
	int place = std::distance(m_shown_rows.begin(),row_pos);<br />
	<br />
	// if the column has an active window -- change it<br />
    int rowActive, colActive;<br />
    if (GetActivePane(&rowActive, &colActive) != NULL &&<br />
         rowActive == place)<br />
    {<br />
          if (++rowActive >= m_nRows)<br />
              rowActive = 0;<br />
          SetActivePane(rowActive, colActive);<br />
    }<br />
<br />
<br />
	m_shown_rows.remove(rowHide);<br />
	m_hid_rows.push_back(rowHide);<br />
<br />
<br />
    m_nRows--;<br />
<br />
	RenumeratePanes();<br />
<br />
	RemoveRowInfo(place,rowHide);<br />
<br />
    RecalcLayout();<br />
}<br />
<br />
void CViewSplitter::ShowRow(int row)<br />
{<br />
     ASSERT_VALID(this);<br />
     ASSERT(m_nRows <= m_nMaxRows);<br />
<br />
	std::list<int>::iterator row_pos;  <br />
<br />
	row_pos = std::find(m_shown_rows.begin(),m_shown_rows.end(),row);<br />
	<br />
	if(row_pos!=m_shown_rows.end())<br />
	{<br />
		//ASSERT(0); <<< PROBLEM!!!<br />
		return;<br />
	}<br />
<br />
	int place = AbsToRelPosition(m_shown_rows, row);<br />
<br />
	m_nRows++;  // add a column<br />
	<br />
	m_shown_rows.push_back(row);<br />
	m_shown_rows.sort();<br />
	m_hid_rows.remove(row);<br />
<br />
	RenumeratePanes();<br />
<br />
	RestoreRowInfo(place, row);<br />
	RecalcLayout();<br />
}


Any help would be greatly appreciated!

Yours Sincerely,
Lea Hayes
GeneralRe: Splitter Window Control Pin
David Crow8-Oct-03 6:43
David Crow8-Oct-03 6:43 
GeneralPrinting size -bmp-help needed! Pin
radha vijay8-Oct-03 5:25
radha vijay8-Oct-03 5:25 
GeneralRe: Printing size -bmp-help needed! Pin
David Crow8-Oct-03 6:45
David Crow8-Oct-03 6:45 
GeneralRe: Printing size -bmp-help needed! Pin
Alex Dolpfin9-Oct-03 3:49
Alex Dolpfin9-Oct-03 3:49 
GeneralRe: One application for two Operating Systems Pin
vcplusplus8-Oct-03 5:23
vcplusplus8-Oct-03 5:23 
Generaldisplaying of string in CEdit or CRichEditCtrl Pin
Neelesh K J Jain8-Oct-03 5:00
Neelesh K J Jain8-Oct-03 5:00 
GeneralRe: displaying of string in CEdit or CRichEditCtrl Pin
Niall Barr8-Oct-03 5:10
professionalNiall Barr8-Oct-03 5:10 
GeneralRe: displaying of string in CEdit or CRichEditCtrl Pin
David Crow8-Oct-03 6:46
David Crow8-Oct-03 6:46 
GeneralPrint Preview - Text extent differs at various zoom states Pin
Andy Latham8-Oct-03 4:43
Andy Latham8-Oct-03 4:43 
GeneralOne application for two Operating Systems Pin
ThakurSaab8-Oct-03 4:41
ThakurSaab8-Oct-03 4:41 
GeneralRe: One application for two Operating Systems Pin
Niall Barr8-Oct-03 4:57
professionalNiall Barr8-Oct-03 4:57 
GeneralGet license key Pin
Anonymous8-Oct-03 4:05
Anonymous8-Oct-03 4:05 
GeneralRe: Get license key Pin
Wes Aday8-Oct-03 4:38
professionalWes Aday8-Oct-03 4:38 
GeneralRe: Get license key Pin
Anonymous8-Oct-03 5:02
Anonymous8-Oct-03 5:02 
GeneralTransparent winows using a bitmap and UpdateLayeredWindow - HELP pls! Pin
xela8-Oct-03 3:49
xela8-Oct-03 3:49 
GeneralCRichEditCtrl::SetParaFormat Pin
Ph@ntom8-Oct-03 3:46
Ph@ntom8-Oct-03 3:46 
GeneralRe: CRichEditCtrl::SetParaFormat Pin
Larry J. Siddens8-Oct-03 7:56
Larry J. Siddens8-Oct-03 7:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.