![]() |
Disable row checkbox |
Post Reply ![]() |
Author | |
markr ![]() Senior Member ![]() Joined: 01 August 2004 Status: Offline Points: 443 |
![]() ![]() ![]() ![]() ![]() 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? |
|
![]() |
|
mdoubson ![]() Senior Member ![]() ![]() Joined: 17 November 2008 Status: Offline Points: 1705 |
![]() ![]() ![]() ![]() ![]() |
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
|
|
![]() |
|
markr ![]() Senior Member ![]() Joined: 01 August 2004 Status: Offline Points: 443 |
![]() ![]() ![]() ![]() ![]() |
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. |
|
![]() |
|
mdoubson ![]() Senior Member ![]() ![]() Joined: 17 November 2008 Status: Offline Points: 1705 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
markr ![]() Senior Member ![]() Joined: 01 August 2004 Status: Offline Points: 443 |
![]() ![]() ![]() ![]() ![]() |
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. |
|
![]() |
|
mdoubson ![]() Senior Member ![]() ![]() Joined: 17 November 2008 Status: Offline Points: 1705 |
![]() ![]() ![]() ![]() ![]() |
Use ON_NOTIFY(NM_CLICK, XTP_ID_REPORT_CONTROL, OnReportItemClick)
void CVirtualListView::OnReportItemClick(NMHDR * pNotifyStruct, LRESULT * /*result*/) |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |