Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - Always show selection
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Always show selection

 Post Reply Post Reply
Author
Message
Lipi View Drop Down
Newbie
Newbie


Joined: 23 November 2012
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote Lipi Quote  Post ReplyReply Direct Link To This Post Topic: Always show selection
    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)
Back to Top
Lipi View Drop Down
Newbie
Newbie


Joined: 23 November 2012
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote Lipi Quote  Post ReplyReply Direct Link To This Post 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;
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.