Print Page | Close Window

How to preserve the selections?

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=11296
Printed Date: 16 November 2024 at 5:34pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How to preserve the selections?
Posted By: CHINSIANG
Subject: How to preserve the selections?
Date Posted: 03 July 2008 at 11:15am
I am using the report control to display a monitored data and constantly updated by a timer.
 
But, when there is an update by calling "Populate()", all the existing selections will be cleared.
 
Anyway to preserve the selection ? I have tried the following, but it crashed.
 
 
 
// Keep the previous selections
CArray<CXTPReportRow*,CXTPReportRow*> arrOldSelectedRows;
CXTPReportSelectedRows *pSelRows = GetSelectedRows();
int nRow;
for (nRow = 0; nRow < pSelRows->GetCount(); nRow++)
{
    arrOldSelectedRows.Add(pSelRows->GetAt(nRow));
}
 
Populate();   
// Restore the previous selections
pSelRows = GetSelectedRows();
for (nRow = 0; nRow < arrOldSelectedRows.GetSize(); nRow++)
{
    pSelRows->Add(arrOldSelectedRows.GetAt(nRow)); // Crash here!!!!
}
 
 
If crashed on this statement:
 
void CXTPReportSelectedRows::Add(CXTPReportRow* pRow)
{
 if (!pRow)
  return;
 _NotifySelChanging(xtpReportSelectionAdd, pRow);
 int nIndex = pRow->GetIndex(); //// Crashed here!
 if (nIndex != -1)
 {
  AddBlock(nIndex, nIndex);
 }
}
 
Any suggestion to preserve the selections?
 
Thanks.
 
 
 



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