Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - How to add CMessageRecordItemCheck class?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to add CMessageRecordItemCheck class?

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


Joined: 07 June 2007
Location: United States
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote Pluto Quote  Post ReplyReply Direct Link To This Post Topic: How to add CMessageRecordItemCheck class?
    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!
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post 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 -
 
Back to Top
Pluto View Drop Down
Newbie
Newbie


Joined: 07 June 2007
Location: United States
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote Pluto Quote  Post ReplyReply Direct Link To This Post 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?
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post 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

 

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.109 seconds.