Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - How to preserve the selections?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to preserve the selections?

 Post Reply Post Reply
Author
Message
CHINSIANG View Drop Down
Newbie
Newbie


Joined: 03 April 2008
Location: Singapore
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote CHINSIANG Quote  Post ReplyReply Direct Link To This Post Topic: How to preserve the selections?
    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.
 
 
 
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.