Print Page | Close Window

[Solved]Prevent from column to displayed as select

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=22598
Printed Date: 28 September 2024 at 1:23pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: [Solved]Prevent from column to displayed as select
Posted By: yoavm
Subject: [Solved]Prevent from column to displayed as select
Date Posted: 11 May 2015 at 5:40pm
One of the column is state and has background color according to a state (Red, Orange, Yellow, and Green). When a row selected the selected color override the entire row including the state column. How I can prevent the state column to get the select color?

I would like that the state column remain its original background when the row selected.

Regards.

Yoav





Replies:
Posted By: olebed
Date Posted: 13 May 2015 at 5:46am
CXTPReportControl::SelectionEnable(FALSE)  for disable selection at all.

OR  If you want remain background only for SOME columns you should change  CXTPReportRow::GetItemMetrics() method. Just  move this line to the end of method
   m_pControl->GetItemMetrics(pDrawArgs, pItemMetrics);

Then you can set background color and other metrics through  XTP_NM_REPORT_GETITEMMETRICS  event. Choose needed recordItems by  pItemNotify->pDrawArgs->pColumn

BEGIN_MESSAGE_MAP(CReportSampleView, CXTPReportView)
ON_NOTIFY(XTP_NM_REPORT_GETITEMMETRICS, XTP_ID_REPORT_CONTROL, OnReportGetItemMetrics)
END_MESSAGE_MAP()

void CReportSampleView::OnReportGetItemMetrics(NMHDR* pNotifyStruct, LRESULT* /*result*/)
{
XTP_NM_REPORTITEMMETRICS* pItemNotify = (XTP_NM_REPORTITEMMETRICS*)pNotifyStruct;

ASSERT(pItemNotify->pDrawArgs);
ASSERT(pItemNotify->pDrawArgs->pControl);
ASSERT(pItemNotify->pDrawArgs->pRow);

// pItemNotify->pDrawArgs->pColumn - may be NULL (for a group row)
// pItemNotify->pDrawArgs->pItem - may be NULL (for a group row)

ASSERT(pItemNotify->pItemMetrics);

// TODO: customize members of pItemNotify->pItemMetrics.

CXTPReportColumn* pColumn = pItemNotify->pDrawArgs->pColumn;
if ( IsStateColumn(pColumn) )
pItemNotify->pItemMetrics->clrBackground = GetBackColorForStateColumn(pColumn);
}



Posted By: yoavm
Date Posted: 13 May 2015 at 11:41am
Solved the problem.
Thanks.


Posted By: olebed
Date Posted: 13 May 2015 at 3:49pm
yoavm, How exactly?


Posted By: yoavm
Date Posted: 13 May 2015 at 6:25pm

By the second option.

I changed CXTPReportRow::GetItemMetrics() method and added OnReportGetItemMetrics. Currently I can set the background and foreground colors of the State column when it selected.
Very nice solution.
 
Yoav



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