![]() |
Tip: Always show selection |
Post Reply ![]() |
Author | |
znakeeye ![]() Senior Member ![]() ![]() Joined: 26 July 2006 Status: Offline Points: 1672 |
![]() ![]() ![]() ![]() ![]() 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:
{ CXTPReportPaintManager::RefreshMetrics(); m_clrSelectedRowText = m_clrHighlightText;
m_clrSelectedRow = m_clrHighlight; } ![]() |
|
![]() |
|
jshan ![]() Groupie ![]() ![]() Joined: 07 December 2007 Status: Offline Points: 63 |
![]() ![]() ![]() ![]() ![]() |
good tip.
thanks znakeeye !
|
|
![]() |
|
SuperMario ![]() Admin Group ![]() ![]() Joined: 14 February 2004 Status: Offline Points: 18057 |
![]() ![]() ![]() ![]() ![]() |
Is this what you are talking about?
GetTargetReport()->GetPaintManager()->m_bHideSelection = FALSE; |
|
![]() |
|
SuperMario ![]() Admin Group ![]() ![]() Joined: 14 February 2004 Status: Offline Points: 18057 |
![]() ![]() ![]() ![]() ![]() |
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." |
|
![]() |
|
znakeeye ![]() Senior Member ![]() ![]() Joined: 26 July 2006 Status: Offline Points: 1672 |
![]() ![]() ![]() ![]() ![]() |
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; } |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |