Print Page | Close Window

How to add CMessageRecordItemCheck class?

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


Topic: How to add CMessageRecordItemCheck class?
Posted By: Pluto
Subject: How to add CMessageRecordItemCheck class?
Date Posted: 22 September 2009 at 5:14pm
Hi everyone,
 
I am struggled this for a few days already. Please help a newbie out. I am trying to add a check box to my ReportControl class.
 
I've added the following to my class' header:

class CMessageRecordItemCheck : public CXTPReportRecordItem

{

DECLARE_SERIAL(CMessageRecordItemCheck)

public:

// Constructs record item with the initial checkbox value.

CMessageRecordItemCheck(BOOL bCheck = FALSE);

// Provides custom group captions depending on checkbox value.

// Returns caption string ID to be read from application resources.

virtual int GetGroupCaptionID(CXTPReportColumn* pColumn);

// Provides custom records comparison by this item based on checkbox value,

// instead of based on captions.

virtual int Compare(CXTPReportColumn* pColumn, CXTPReportRecordItem* pItem);

};
 
 
 
 
I also added the floowing to my class' cpp file:

IMPLEMENT_SERIAL(CMessageRecordItemCheck, CXTPReportRecordItem, VERSIONABLE_SCHEMA | _XTP_SCHEMA_CURRENT)

CMessageRecordItemCheck::CMessageRecordItemCheck(BOOL bCheck)

{

HasCheckbox(TRUE);

SetChecked(bCheck);

}

int CMessageRecordItemCheck::GetGroupCaptionID(CXTPReportColumn* /*pColumn*/)

{ return IsChecked()? IDS_GROUP_CHECKED_TRUE: IDS_GROUP_CHECKED_FALSE; }

int CMessageRecordItemCheck::Compare(CXTPReportColumn* /*pColumn*/, CXTPReportRecordItem* pItem)

{ return int(IsChecked()) - int(pItem->IsChecked()); }

 
 
I created the checkbox column by:

pColumn = AddColumn(new CXTPReportColumn(CXTPReportColumn(COLUMN_CHECK, _T(""), 18, FALSE, COLUMN_CHECK_ICON)) );

 
I added the item to the record at the beginning of the record by:

pItem = pRecord->AddItem(new CMessageRecordItemCheck(bChecked));

 
I am able to see the check box icon in the column header but I am not able to see a checkbox in any row. Did I miss anything? Is there a detail tutorial for this somewhere?
 
Any input is appreciated!



Replies:
Posted By: mdoubson
Date Posted: 23 September 2009 at 12:04am
Please look and analyze MFC ReportSample where CMessageRecord have checkbox item as you can see in this static exe -
 
https://forum.codejock.com/uploads/DemoVersion/ReportSample12-1-Core13-2-Static.rar - https://forum.codejock.com/uploads/DemoVersion/ReportSample12-1-Core13-2-Static.rar
https://forum.codejock.com/uploads/DemoVersion/ReportSampleStatic.rar - https://forum.codejock.com/uploads/DemoVersion/ReportSampleStatic.rar


-------------
Mark Doubson, Ph.D.


Posted By: Pluto
Date Posted: 23 September 2009 at 12:49pm
Thank you! I've checked the samples and I am expecting the similar effects on my code. I just not sure what went wrong. Any hints? What else do I miss?


Posted By: mdoubson
Date Posted: 24 September 2009 at 2:57pm
You don't need to create special CMessageRecordItemCheck
Just use usual CXTPReportRecordItem
and call function CXTPReportRecordItem::HasCheckbox(BOOL bHasCheckbox, BOOL bTristate = FALSE)
to setup checkbox if needed and usual or 3-state checkbox type

// Adds check box area for item.

// Parameters:

// bHasCheckbox - TRUE if item has check box area.

// bTristate - TRUE is tri-state checkbox, FALSE - if usual

// See Also: SetChecked, IsChecked

 



-------------
Mark Doubson, Ph.D.



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