Print Page | Close Window

CXTPReportControl::ReleaseItem error

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=6410
Printed Date: 08 May 2024 at 3:52pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPReportControl::ReleaseItem error
Posted By: yayo
Subject: CXTPReportControl::ReleaseItem error
Date Posted: 14 February 2007 at 5:15am

 // yayo 2007.02.14 ==> modify

 int nColCnt = pColumns->GetCount()-1;
 for (i = nColCnt; i >=0 ; i--)
 {
  CXTPReportColumn* pColumn = pColumns->GetAt(i);

  if (pColumn->m_nItemIndex > nIndex)
  {
   pColumn->m_nItemIndex--;
  }
  else if (pColumn->m_nItemIndex == nIndex)
  {
   pColumns->Remove(pColumn);
  }
 }

 //for (i = 0; i < pColumns->GetCount(); i++)
 //{
 // CXTPReportColumn* pColumn = pColumns->GetAt(i);

 // if (pColumn->m_nItemIndex > nIndex) // not excute
 // {
 //  pColumn->m_nItemIndex--;
 // }
 // else if (pColumn->m_nItemIndex == nIndex)
 // {
 //  pColumns->Remove(pColumn);
 // }
 //}

 
 


-------------
hi



Replies:
Posted By: sserge
Date Posted: 16 February 2007 at 4:29pm
Hi, thanks! This should be actually modified, but your version is also not quite correct. Final version will be:

CXTPReportColumn* pColumnToRemove = NULL;
 
 for (i = 0; i < pColumns->GetCount(); i++)
 {
  CXTPReportColumn* pColumn = pColumns->GetAt(i);
 
  if (pColumn->m_nItemIndex > nIndex)
  {
   pColumn->m_nItemIndex--;
  }
  else if (pColumn->m_nItemIndex == nIndex)
  {
   pColumnToRemove = pColumn;
  }
 }
 
 if (pColumnToRemove)
  pColumns->Remove(pColumnToRemove);


--
WBR,
Serge


Posted By: yayo
Date Posted: 20 February 2007 at 5:39am

OK, It is my mistake !!

thanks!!


-------------
hi



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net