Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - CXTPReportControl RedrawControl() vs. Populate()
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTPReportControl RedrawControl() vs. Populate()

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


Joined: 20 April 2005
Location: Czech Republic
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote lajbr Quote  Post ReplyReply Direct Link To This Post Topic: CXTPReportControl RedrawControl() vs. Populate()
    Posted: 10 May 2007 at 5:28am
Hi,

I have a problem with CXTPReportControl in CodeJock 10.4.2. I use CXTPReportControl and I use it to representation of e-mail folder. In so case I need to add and remove items/e-mails very often. I supposed that I have to use only Populate() to propagate the changes. But I have found that there is CXTPReportControl::RedrawControl() too and that should be possible to use it in combination with BeginUpdate() and EndUpdate() in this situation. So I wrote a method where I added one item enwrap with BeginUpdate()  and EndUpdate(), where CReportEmailView is class based on CXTPReportView:

void CReportEmailView::AddTestItem(MAILCONTEXT pNewCtx)
{
GetReportCtrl().BeginUpdate();
lRet = AddContextItem(pNewCtx);
if(!lRet)
    RedrawControl();
GetReportCtrl().EndUpdate();
}

int CReportEmailView::AddContextItem
(MAILCONTEXT pNewCtx)
{
... // getting parameters
//add new record
CXTPReportRecord *pRecord = AddRecord(...parameters...);

    return 0;
}

I supposed that it will work because there is written: "If you want to add items one at a time using the AddRecord method, or to make some another operations in a single sequence, you can use the BeginUpdate method to prevent the control from repainting the CXTPReportControl each time an item is added. Once you have completed the task of adding items to the control, call the EndUpdate method to enable the CXTPReportControl to repaint. This way of adding items can prevent flickered drawing of the CXTPReportControl when a large number of items are being added to the control." in the help file. But it doesn't work. I don't know why the change isn't propagate to the output even if the new record is successfully added to the control and RedrawControl() is called from the EndUpdate(). Please, can you help me where the problem is or is it neccessary to use only Populate() for ensure correct state of CXTPReportControl?

Thanks you beforehand for your suggestions and answers.

Lajbr
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: 10 May 2007 at 4:57pm
Hi,

After modifying a Records collection you have to call Populate, because this method actually clears all current rows, prepare Records to be shown (performs grouping, sorting, filtering and others) and then populates an array of Rows which is actually visible for a user.

Hope described this better then in help files...

--
WBR,
Serge
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.