Print Page | Close Window

Record & Item Capabilities

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=2984
Printed Date: 24 November 2024 at 5:23am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Record & Item Capabilities
Posted By: mehran20
Subject: Record & Item Capabilities
Date Posted: 01 October 2005 at 4:40am

Hi,

I have just started working with CXTPReportControl and I was wondering if I can draw anything I want in a CXTPReportRecordItem driven object!

For example,an icon bigger than 16*16?




Replies:
Posted By: sserge
Date Posted: 03 October 2005 at 8:52am
Mehran,

Yes you can. But in this case you should manually implement overrides of some more methods, i.e. which return a Row height, etc.

--
WBR,
Serge


Posted By: mehran20
Date Posted: 14 October 2005 at 11:26pm

Well I wanted to keep this question going long before but this forum was closed for a week!!

By this time I tried so much to work with CXTPReportRow but I failed and since I could find no practical example and there was nothing in the CHM reference file either, the only way left was to ask for it. Please take a look at my code below:



class ReportItemCheck : public CXTPReportRecordItem
{
public:
 ReportItemCheck(BOOL bCheck) {
  HasCheckbox(TRUE);
  SetChecked(bCheck);
 }
 virtual int GetGroupCaptionID(CXTPReportColumn* pColumn) {
  return IsChecked()? 0: 1;
 }
 virtual int Compare(CXTPReportColumn* pColumn, CXTPReportRecordItem* pItem) {
  return int(IsChecked()) - int(pItem->IsChecked());
 }
};

class myReportRow : public CXTPReportGroupRow {
public:
 myReportRow() : CXTPReportGroupRow() { }
 virtual ~myReportRow() { }
 virtual int GetHeight(CDC* pDC) {
  return m_nIndex * 20 + 10;
 }
};

class myReportCtrl : public CXTPReportControl {
public:
 myReportCtrl() : CXTPReportControl() { }
 virtual ~myReportCtrl() { }
 int InsertRow(int nIndex, CXTPReportRow* pRow) {
  return CXTPReportControl::InsertRow(nIndex, pRow);
 }
};


//////////////////////////////////////////////////////////// ////////////
/// Somewhere in OnInitDialog
//////////////////////////////////////////////////////////// ////////////
{
 ...
 ...
 ...

 reportCtrl = new myReportCtrl();
 reportCtrl->Create(WS_CHILD|WS_TABSTOP|WS_VISIBLE|W M_VSCROLL|WS_CLIPCHILDREN|WS_CLIPSIBLINGS|WS_TABSTOP, CRect(0, 0, 400, 250), this, 0);
 reportCtrl->GetReportHeader()->AllowColumnRemove (FALSE);

 CXTPReportColumn* nameColumn = new CXTPReportColumn(0, TEXT("Name"), 250, TRUE, XTP_REPORT_NOICON, FALSE);
 reportCtrl->AddColumn(nameColumn);
 CXTPReportColumn* checkColumn = new CXTPReportColumn(1, TEXT("Check"), 18, FALSE, XTP_REPORT_NOICON, FALSE);
 reportCtrl->AddColumn(checkColumn);

 myReportRow* row;
 CXTPReportRecord* record;
 CXTPReportRecord* record1;
 CXTPReportRecordItem* item;

 record = new CXTPReportRecord();
 record->AddItem(new CXTPReportRecordItemText(TEXT("John")));
 record->AddItem(new ReportItemCheck(true));
 row = new myReportRow();
 row->InitRow(reportCtrl, record);
 reportCtrl->InsertRow(0, row);

 record = new CXTPReportRecord();
 record->AddItem(new CXTPReportRecordItemText(TEXT("Joe")));
 record->AddItem(new ReportItemCheck(false));
 row = new myReportRow();
 row->InitRow(reportCtrl, record);
 reportCtrl->InsertRow(1, row);

 record1 = new CXTPReportRecord();
 record1->AddItem(new CXTPReportRecordItemText(TEXT("Jason (Joe's son)")));
 record1->AddItem(new ReportItemCheck(true));
 row = new myReportRow();
 row->InitRow(reportCtrl, record1);
 record->GetChilds()->Add(record1);
 reportCtrl->InsertRow(2, row);

 // At This Point I can see that 'rows' is filled with
 //  the rows I have inserted, but nothing to show yet!!
 CXTPReportRows* rows = reportCtrl->GetRows();

 reportCtrl->GetColumns()->Find(0)->SetTreeCol umn(TRUE);
 reportCtrl->Populate();

 ...
 ...
 ...
}

I put a break point in myReportRow::GetHeight method to see if it's called, but it didn't, not at all. More important it did not show any item in the Report Control!! It says, there's no Item to show!!

Would you please tell me how can I make use of CXTReportRow objects?!

Thanks,

Mehran Ziadloo



Posted By: mehran20
Date Posted: 14 October 2005 at 11:55pm

Sorry, since I tried so many different ways it seems I sent a wrong code. I had to define the myReportRow class like this:


class myReportRow : public CXTPReportRow {
public:
 myReportRow() : CXTPReportRow() { }
 virtual ~myReportRow() { }
 virtual int GetHeight(CDC* pDC) {
  return m_nIndex * 20 + 10;
 }
};




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