Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Task Panel
  New Posts New Posts RSS Feed - Keep focus rectangle on lost focus
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Keep focus rectangle on lost focus

 Post Reply Post Reply
Author
Message
Michl View Drop Down
Senior Member
Senior Member


Joined: 14 September 2007
Status: Offline
Points: 138
Post Options Post Options   Thanks (0) Thanks(0)   Quote Michl Quote  Post ReplyReply Direct Link To This Post Topic: Keep focus rectangle on lost focus
    Posted: 24 March 2014 at 6:30am
Hello

Is this feature beside the point?
That's not easy to implement in current achitecture of codejock.

Problem 1:
Rectangle is disabled in OnKillFocus.


void CXTPTaskPanel::OnKillFocus(CWnd* pNewWnd)
{
    CWnd::OnKillFocus(pNewWnd);

    m_bDrawFocusRect = FALSE;

    Redraw();

}



Problem 2:
IsDrawFocusRect returns always false because ::GetFocus() == m_hWnd


int CXTPTaskPanelToolboxTheme::DrawGroupCaption(CDC* pDC, CXTPTaskPanelGroup* pGroup, BOOL bDraw)
{
   ...
            if (pGroup->IsItemFocused() && pGroup->GetTaskPanel()->IsDrawFocusRect())
            {
                rcText.DeflateRect(-1, 2);
                DrawFocusRect(pDC, rcText);
            }
   ...
}

BOOL CXTPTaskPanel::IsDrawFocusRect() const
{
    return m_bDrawFocusRect && (::GetFocus() == m_hWnd);
}



Unfortunately IsDrawFocusRect() isn't virtual.

Make it sense to change m_bDrawFocusRect into an enumerator with 3 states?
- None
- DrawFocusRectActive
- DrawFocusRectAlways

Thanks
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.156 seconds.