Print Page | Close Window

Disable row checkbox

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=15563
Printed Date: 28 April 2024 at 12:17pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Disable row checkbox
Posted By: markr
Subject: Disable row checkbox
Date 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?



Replies:
Posted By: mdoubson
Date 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


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


Posted By: markr
Date 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.


Posted By: mdoubson
Date 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


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


Posted By: markr
Date 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.


Posted By: mdoubson
Date Posted: 11 November 2009 at 12:24pm
Use ON_NOTIFY(NM_CLICK, XTP_ID_REPORT_CONTROL, OnReportItemClick)

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



-------------
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