Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - Disable row checkbox
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Disable row checkbox

 Post Reply Post Reply
Author
Message
markr View Drop Down
Senior Member
Senior Member


Joined: 01 August 2004
Status: Offline
Points: 441
Post Options Post Options   Thanks (0) Thanks(0)   Quote markr Quote  Post ReplyReply Direct Link To This Post Topic: Disable row checkbox
    Posted: 06 November 2009 at 4:22pm
Hello,

I have a report control instance running in virtual mode, and one of the columns is using checkboxes.

What I would like to do is disable this checkbox for certain report rows.

Is this possible? If so, how?
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: 09 November 2009 at 5:15pm
You can add and use function

ON_NOTIFY(NM_CLICK, XTP_ID_REPORT_CONTROL, OnReportItemClick)

void YourView::OnReportItemClick(NMHDR * pNotifyStruct, LRESULT * /*result*/)
and implement your logic here
Back to Top
markr View Drop Down
Senior Member
Senior Member


Joined: 01 August 2004
Status: Offline
Points: 441
Post Options Post Options   Thanks (0) Thanks(0)   Quote markr Quote  Post ReplyReply Direct Link To This Post Posted: 10 November 2009 at 10:28am
Hi Mark,

Thanks for your feedback. Unfortunately, handling the checkbox click event doesn't really work for me. I need the ability to show that the row checkbox is disabled before the user attempts to click it.

Is there any way to change the glyph being used to draw the checkbox from within GetItemMetrics() override? If I could have certain rows draw a disabled checkbox, that would do the trick nicely.
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: 10 November 2009 at 11:34am
You can - smth like this: in void CVirtualRecord::GetItemMetrics(XTP_REPORTRECORDITEM_DRAWARGS* pDrawArgs, XTP_REPORTRECORDITEM_METRICS* pItemMetrics)

CXTPReportRecordItem* pItem = pDrawArgs->pItem;

if (pItem) { if (_Your Condition_)

{ pItem->HasCheckbox(TRUE, TRUE); pItem->SetCheckedState(...); } else pItem->HasCheckbox(FALSE, TRUE); }
So you will have checkboxes only in needed rows according your condition
Back to Top
markr View Drop Down
Senior Member
Senior Member


Joined: 01 August 2004
Status: Offline
Points: 441
Post Options Post Options   Thanks (0) Thanks(0)   Quote markr Quote  Post ReplyReply Direct Link To This Post Posted: 11 November 2009 at 12:14pm
Thanks for the idea. After playing around with this concept a bit, I got very close to what I'm looking for with this:

if (__condition__)
{
   pDrawArgs->pItem->SetEditable(TRUE);
}
else
{
   pDrawArgs->pItem->SetChecked(FALSE);
   pDrawArgs->pItem->SetEditable(FALSE);
}

This gives me precisely the appearance I'm after, but unfortunately the editable checkboxes no longer function correctly after I do this. In fact, my XTP_NM_REPORT_CHECKED event handler doesn't even fire once I put this code into place.
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: 11 November 2009 at 12:24pm
Use ON_NOTIFY(NM_CLICK, XTP_ID_REPORT_CONTROL, OnReportItemClick)

void CVirtualListView::OnReportItemClick(NMHDR * pNotifyStruct, LRESULT * /*result*/)

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