Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - Removing Rows?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Removing Rows?

 Post Reply Post Reply
Author
Message
skemp@docucorp View Drop Down
Newbie
Newbie


Joined: 08 August 2006
Location: United States
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote skemp@docucorp Quote  Post ReplyReply Direct Link To This Post Topic: Removing Rows?
    Posted: 29 August 2006 at 11:45am
I have a report control on a dialog.  I am performing a process on the selected rows and as each is sucessfully done, I want to remove the row and record.  Below is the code I am trying but the row still seems to display.
 
CXTPReportSelectedRows* pSelectedRows = m_wndReport.GetSelectedRows();
POSITION pos = pSelectedRows->GetFirstSelectedRowPosition();
while (pos)
{
  CXTPReportRow* pRow = pSelectedRows->GetNextSelectedRow(pos);
  CFileInfoRecord *pRecord;
  pRecord = (CFileInfoRecord *)pRow->GetRecord();
  if (pRecord)
  {
    if (pRecord->m_pDllInfo)
    {
      if (pRecord->m_pDllInfo->OnDrop(pRecord->m_pDoc, pRecord->m_localFileH))
      {
        pSelectedRows->Remove(pRow);
        int idx = pRecord->GetIndex();
        m_wndReport.GetRecords()->RemoveAt(idx);
        m_wndReport.RedrawControl();
      }
    }
  }
}
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 29 August 2006 at 4:33pm
Hi,

When you removing records, calling RedrawControl is not enough.

In the end of your loop you should call m_wndReport.Populate();

--
WBR,
Serge
Back to Top
dandan View Drop Down
Newbie
Newbie
Avatar

Joined: 05 January 2007
Location: Austria
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote dandan Quote  Post ReplyReply Direct Link To This Post Posted: 23 February 2007 at 6:04am
hi, is there also an easy and fast method to remove all rows and columns, to get an empty ReportControl, and fill it again with completely other data?
 
destroying the object and create it again does for some reason not work in the way as i expected.
Back to Top
FSauer View Drop Down
Groupie
Groupie
Avatar

Joined: 10 May 2006
Location: Germany
Status: Offline
Points: 96
Post Options Post Options   Thanks (0) Thanks(0)   Quote FSauer Quote  Post ReplyReply Direct Link To This Post Posted: 23 February 2007 at 7:13am
Hi.
 
Use this to remove all Rows and all Columns:
 
//CXTPReportControl m_wndReportCtrl;
 
//Remove all Rows
m_wndReportCtrl.GetRecords()->RemoveAll();
 
//Remove all Columns
int count = m_wndReportCtrl.GetColumns()->GetCount();
for(int i=0; i < count; i++){
m_wndReportCtrl.GetColumns()->Remove(m_wndReportCtrl.GetColumns()->GetAt(i))
}
m_wndReportCtrl.Populate();
Back to Top
dandan View Drop Down
Newbie
Newbie
Avatar

Joined: 05 January 2007
Location: Austria
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote dandan Quote  Post ReplyReply Direct Link To This Post Posted: 23 February 2007 at 8:13am
thanks a lot! :-)
 
if everything could be that easy :-)
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.