How to preserve the selections? |
Post Reply |
Author | |
CHINSIANG
Newbie Joined: 03 April 2008 Location: Singapore Status: Offline Points: 1 |
Post Options
Thanks(0)
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.
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |