Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - [SOLVED] RemoveRecordEx(..) in Virtual Mode.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Topic Closed[SOLVED] RemoveRecordEx(..) in Virtual Mode.

 Post Reply Post Reply
Author
Message
Makarand View Drop Down
Senior Member
Senior Member
Avatar

Joined: 27 February 2007
Location: India
Status: Offline
Points: 140
Direct Link To This Post Topic: [SOLVED] RemoveRecordEx(..) in Virtual Mode.
    Posted: 25 May 2011 at 5:38am
Hello CJ Team,

Deleting selected record from the virtual mode should decrease record count. Please go through following sample code


 int count =GetReportCtrl().GetRecords()->GetCount();
//eg. count is 100
//Selected 10 records and delete them. Expected count should be 90
  CXTPReportSelectedRows* pSelectedRows = GetReportCtrl().GetSelectedRows();
if(!pSelectedRows)
return;
int nRow = pSelectedRows->GetCount() - 1;
if(nRow < 0)
return;
CWaitCursor wc;
CXTPReportRow* pFocusedRow = pSelectedRows->GetAt(pSelectedRows->GetCount() - 1);
pFocusedRow = GetRows()->GetAt(pFocusedRow->GetIndex() + 1);
while(nRow >= 0)
{
CXTPReportRecord* pRecord = pSelectedRows->GetAt(nRow--)->GetRecord();
if(pRecord)
GetReportCtrl().RemoveRecordEx(pRecord);
if(nRow >= pSelectedRows->GetCount())
nRow = pSelectedRows->GetCount() - 1;
}
GetReportCtrl().SetFocusedRow(pFocusedRow ? pFocusedRow : GetReportCtrl().GetFocusedRow());

 count =GetReportCtrl().GetRecords()->GetCount();
//Actual count still 100 Angry

Problem when it comes in the GetItemMetrics(..) and trying to fetch the records which are already deleted (Records from 90 to 100).

Waiting for reply.

-Mak
-Mak
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1198
Direct Link To This Post Posted: 25 May 2011 at 5:59am
Hi;

Whenever you delete records in virtual mode you have to perform it in the underlying (extern) data container (not part of the report control) then you have to call SetVirtualMode(new MyRecordType(...), NewNumberOfElements); followed by Populate();
I've never tried to manipulate the records collection of the report control directly in virtual mode since it makes no sense, but I believe thats absolutely wrong! The control only holds one dummy record and calls GetItemMetrics() whenever a row should be drawn.

Martin

Product: Xtreme Toolkit v 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017
Back to Top
ABuenger View Drop Down
Newbie
Newbie
Avatar

Joined: 02 February 2006
Status: Offline
Points: 1075
Direct Link To This Post Posted: 25 May 2011 at 8:12am
Martin is right here, you can not manipulate the report control in virtual mode.

Codejock support
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.142 seconds.