Print Page | Close Window

Removing Rows?

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=4915
Printed Date: 27 September 2024 at 1:23pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Removing Rows?
Posted By: skemp@docucorp
Subject: Removing Rows?
Date Posted: 29 August 2006 at 11:45am
I have a report control on a dialog.  I am performing a process on the selected rows and as each is sucessfully done, I want to remove the row and record.  Below is the code I am trying but the row still seems to display.
 
CXTPReportSelectedRows* pSelectedRows = m_wndReport.GetSelectedRows();
POSITION pos = pSelectedRows->GetFirstSelectedRowPosition();
while (pos)
{
  CXTPReportRow* pRow = pSelectedRows->GetNextSelectedRow(pos);
  CFileInfoRecord *pRecord;
  pRecord = (CFileInfoRecord *)pRow->GetRecord();
  if (pRecord)
  {
    if (pRecord->m_pDllInfo)
    {
      if (pRecord->m_pDllInfo->OnDrop(pRecord->m_pDoc, pRecord->m_localFileH))
      {
        pSelectedRows->Remove(pRow);
        int idx = pRecord->GetIndex();
        m_wndReport.GetRecords()->RemoveAt(idx);
        m_wndReport.RedrawControl();
      }
    }
  }
}



Replies:
Posted By: sserge
Date Posted: 29 August 2006 at 4:33pm
Hi,

When you removing records, calling RedrawControl is not enough.

In the end of your loop you should call m_wndReport.Populate();

--
WBR,
Serge


Posted By: dandan
Date Posted: 23 February 2007 at 6:04am
hi, is there also an easy and fast method to remove all rows and columns, to get an empty ReportControl, and fill it again with completely other data?
 
destroying the object and create it again does for some reason not work in the way as i expected.


Posted By: FSauer
Date Posted: 23 February 2007 at 7:13am
Hi.
 
Use this to remove all Rows and all Columns:
 
//CXTPReportControl m_wndReportCtrl;
 
//Remove all Rows
m_wndReportCtrl.GetRecords()->RemoveAll();
 
//Remove all Columns
int count = m_wndReportCtrl.GetColumns()->GetCount();
for(int i=0; i < count; i++){
m_wndReportCtrl.GetColumns()->Remove(m_wndReportCtrl.GetColumns()->GetAt(i))
}
m_wndReportCtrl.Populate();


Posted By: dandan
Date Posted: 23 February 2007 at 8:13am
thanks a lot! :-)
 
if everything could be that easy :-)



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