Print Page | Close Window

Always show selection

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=20321
Printed Date: 19 May 2024 at 6:49am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Always show selection
Posted By: Lipi
Subject: Always show selection
Date Posted: 23 November 2012 at 8:51am
Hi,

Is there a way to always show the current selection in the CXTPReportControl even if the report has not the focus?

(as CTreeCtrl does with flag TVS_SHOWSELALWAYS)



Replies:
Posted By: Lipi
Date Posted: 26 November 2012 at 4:39am
I found a way to do this.

In my CustomRecord class derived from CXTPReportRecord, i redefine GetItemMetrics() :
void CustomRecord::GetItemMetrics( XTP_REPORTRECORDITEM_DRAWARGS* pDrawArgs, XTP_REPORTRECORDITEM_METRICS* pItemMetrics )
{
     if(pDrawArgs->pRow->IsSelected())// to highlight selected row even if the control hasnt the focus
     {
          CXTPReportPaintManager *pPaintManager = pDrawArgs->pControl->GetPaintManager();
          pItemMetrics->clrForeground = pPaintManager->m_clrHighlightText;
          pItemMetrics->clrBackground = pPaintManager->m_clrHighlight;
     }
     else
     if ((pDrawArgs->pRow->GetIndex() % 2) && !pDrawArgs->pItem->IsPreviewItem())//one row on two will be a little bit grey
     {
          pItemMetrics->clrBackground = RGB(240, 240, 240);
     }
}

and i set the "m_bHideSelection" of the paintManager of the ReportControl to TRUE in the init() of my view
m_report_elements.GetPaintManager()->m_bHideSelection = TRUE;



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