Print Page | Close Window

Tip: 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=11285
Printed Date: 20 June 2025 at 5:33am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Tip: Always show selection
Posted By: znakeeye
Subject: Tip: Always show selection
Date Posted: 02 July 2008 at 6:39pm
I know many of us want the selection to be visible even when the report control loses focus. It turns out this is quite tricky to accomplish, but I found a quite simple solution:
 
Derive a custom class from CXTPReportPaintManager and override RefreshMetrics:
 
virtual void RefreshMetrics()
{
     CXTPReportPaintManager::RefreshMetrics();
      
     m_clrSelectedRowText = m_clrHighlightText;
     m_clrSelectedRow = m_clrHighlight;
}
 



Replies:
Posted By: jshan
Date Posted: 02 July 2008 at 10:00pm
Originally posted by znakeeye znakeeye wrote:

I know many of us want the selection to be visible even when the report control loses focus. It turns out this is quite tricky to accomplish, but I found a quite simple solution:
 
Derive a custom class from CXTPReportPaintManager and override RefreshMetrics:
 
virtual void RefreshMetrics()
{
     CXTPReportPaintManager::RefreshMetrics();
      
     m_clrSelectedRowText = m_clrHighlightText;
     m_clrSelectedRow = m_clrHighlight;
}
 
 
good tip.
thanks znakeeye !
 
 


Posted By: SuperMario
Date Posted: 03 July 2008 at 9:34am
Is this what you are talking about?

GetTargetReport()->GetPaintManager()->m_bHideSelection = FALSE;


Posted By: SuperMario
Date Posted: 03 July 2008 at 9:43am
Also we added the above 2 properties for this exact purpose.

From COM help file:

"Can be useful when the report loses focus and you do not want the color of the focused row to change."


Posted By: znakeeye
Date Posted: 04 July 2008 at 1:03am

Nope, it doesn't work. In fact, m_bHideSelection does the exact opposite:

if (GetControl()->HasFocus())
{
   pItemMetrics->clrForeground = pPaintManager->m_clrHighlightText;
   pItemMetrics->clrBackground = pPaintManager->m_clrHighlight;
}
else if (!pPaintManager->m_bHideSelection)
{
  
   pItemMetrics->clrForeground = pPaintManager->m_clrSelectedRowText;
   pItemMetrics->clrBackground = pPaintManager->m_clrSelectedRow;
}
 
The correct solution is quite obvious:
if (!pPaintManager->m_bHideSelection || GetControl()->HasFocus())
{
   pItemMetrics->clrForeground = pPaintManager->m_clrHighlightText;
   pItemMetrics->clrBackground = pPaintManager->m_clrHighlight;
}



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