Print Page | Close Window

Keep focus rectangle on lost focus

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Task Panel
Forum Description: Topics Related to Codejock Task Panel
URL: http://forum.codejock.com/forum_posts.asp?TID=22250
Printed Date: 21 November 2024 at 8:35am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Keep focus rectangle on lost focus
Posted By: Michl
Subject: Keep focus rectangle on lost focus
Date 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



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