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

Tip: Always show selection

 Post Reply Post Reply
Author
Message
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Topic: Tip: Always show selection
    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;
}
 
Back to Top
jshan View Drop Down
Groupie
Groupie
Avatar

Joined: 07 December 2007
Status: Offline
Points: 63
Post Options Post Options   Thanks (0) Thanks(0)   Quote jshan Quote  Post ReplyReply Direct Link To This Post 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 !
 
 
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 03 July 2008 at 9:34am
Is this what you are talking about?

GetTargetReport()->GetPaintManager()->m_bHideSelection = FALSE;
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post 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."
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post 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;
}
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.