Print Page | Close Window

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

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=18437
Printed Date: 29 September 2024 at 3:26am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: [SOLVED] RemoveRecordEx(..) in Virtual Mode.
Posted By: Makarand
Subject: [SOLVED] RemoveRecordEx(..) in Virtual Mode.
Date 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



Replies:
Posted By: mgampi
Date 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


Posted By: ABuenger
Date Posted: 25 May 2011 at 8:12am
Martin is right here, you can not manipulate the report control in virtual mode.



-------------
Codejock support



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