Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - Record & Item Capabilities
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Record & Item Capabilities

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


Joined: 10 September 2005
Location: Iran
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote mehran20 Quote  Post ReplyReply Direct Link To This Post Topic: Record & Item Capabilities
    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?

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: 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
Back to Top
mehran20 View Drop Down
Newbie
Newbie


Joined: 10 September 2005
Location: Iran
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote mehran20 Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
mehran20 View Drop Down
Newbie
Newbie


Joined: 10 September 2005
Location: Iran
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote mehran20 Quote  Post ReplyReply Direct Link To This Post 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;
 }
};

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0.094 seconds.