Print Page | Close Window

Bug - Clipped caption text

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Skin Framework
Forum Description: Topics Related to Codejock Skin Framework
URL: http://forum.codejock.com/forum_posts.asp?TID=23431
Printed Date: 20 June 2018 at 1:05pm


Topic: Bug - Clipped caption text
Posted By: mgampi
Subject: Bug - Clipped caption text
Date Posted: 30 August 2017 at 3:15am
Hi;

I'm using the skin framework for my application, but it clips the caption in title bar of the application.
See Screenshot!



How can I fix this?

TIA


-------------
Martin

Product: Xtreme Toolkit v 15.3.1, new Projects v 18.3.0
Platform: Windows 8.1 (64bit)
Language: VC++ 20



Replies:
Posted By: jpbro
Date Posted: 30 August 2017 at 10:16am
I think if you are using the CommandBar with EnableFrameTheme, then you should exclude that window from the SkinFramework with a RemoveWindow call. Let the CommandBars do all the drawing in that case (again, I think this will work, not 100% sure).


-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: mgampi
Date Posted: 30 August 2017 at 11:12am
Hi;

I already remove the main window from SkinFramework...


-------------
Martin

Product: Xtreme Toolkit v 15.3.1, new Projects v 18.3.0
Platform: Windows 8.1 (64bit)
Language: VC++ 20


Posted By: mgampi
Date Posted: 01 September 2017 at 3:01pm
Still no comment from CJ?


-------------
Martin

Product: Xtreme Toolkit v 15.3.1, new Projects v 18.3.0
Platform: Windows 8.1 (64bit)
Language: VC++ 20


Posted By: olebed
Date Posted: 02 January 2018 at 5:27am
Hello,

It is can be result of bug in methods CXTPSkinManagerApiHook::OnHookSystemParametersInfoA/W
BOOL WINAPI CXTPSkinManagerApiHook::OnHookSystemParametersInfoA(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni)
{
    XTP_SKINFRAMEWORK_MANAGE_STATE();

    CXTPSkinManagerApiFunction* pFunction = EnterHookedCall(xtpSkinApiSystemParametersInfoA);
    if (NULL == pFunction)
    {
        return FALSE;
    }

    typedef BOOL(WINAPI* LPFNSYSTEMPARAMETERSINFO)(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni);
    BOOL bResult = ((LPFNSYSTEMPARAMETERSINFO)pFunction->m_pfnOrig)(uiAction, uiParam, pvParam, fWinIni);

    XTP_GUARD_SHARED_(CXTPSkinManager, XTPSkinManager(), pSkinManager)
    {
        if (!pSkinManager->IsEnabled() || pSkinManager->GetMetrics()->m_bRefreshMetrics)
            return bResult;

        if (!pSkinManager->HasApplyOptions(xtpSkinApplyMetrics | xtpSkinApplyColors | xtpSkinApplyFrame))
            return bResult;

        if (uiAction == SPI_GETICONTITLELOGFONT && uiParam == sizeof(LOGFONTA))
        {
#ifndef _UNICODE
            LOGFONTA* pLogFont = reinterpret_cast<LOGFONTA*>(pvParam);
            ASSERT(NULL != pLogFont);
#else
            LOGFONTW logFont;
            LOGFONTW* pLogFont = &logFont;
#endif

            XTP_GUARD_SHARED_(CXTPSkinManagerSchema, XTPSkinManager()->GetSchema(), pSchema)
            {
                UINT nSysMetrics = pSchema->GetClassCode(_T("SYSMETRICS"));

                pSchema->GetFontProperty(nSysMetrics, 0, 0, TMT_ICONTITLEFONT, *pLogFont);

#ifdef _UNICODE
                LOGFONTA* pLogFontA = reinterpret_cast<LOGFONTA*>(pvParam);
                ASSERT(NULL != pLogFontA);

                memcpy(pLogFontA, pLogFont, offsetof(LOGFONTA, lfFaceName));
                WCSTOMBS_S(pLogFontA->lfFaceName, pLogFont->lfFaceName, _countof(pLogFontA->lfFaceName));
#endif
            }
        }

        if (uiAction == SPI_GETNONCLIENTMETRICS && uiParam == sizeof(NONCLIENTMETRICSA))
        {
            XTP_GUARD_SHARED_(CXTPSkinManagerSchema, XTPSkinManager()->GetSchema(), pSchema)
            {
                UINT nSysMetrics = pSchema->GetClassCode(_T("SYSMETRICS"));

                LOGFONT lfMenuFont, lfStatusFont, lfCaptionFont, lfSmCaptionFont;
                pSchema->GetFontProperty(nSysMetrics, 0, 0, TMT_MENUFONT, lfMenuFont);
                pSchema->GetFontProperty(nSysMetrics, 0, 0, TMT_STATUSFONT, lfStatusFont);
                pSchema->GetFontProperty(nSysMetrics, 0, 0, TMT_CAPTIONFONT, lfCaptionFont);
                pSchema->GetFontProperty(nSysMetrics, 0, 0, TMT_SMALLCAPTIONFONT, lfSmCaptionFont);

                NONCLIENTMETRICSA* pncm = reinterpret_cast<NONCLIENTMETRICSA*>(pvParam);
                ASSERT(NULL != pncm);

#ifndef _UNICODE
                memcpy(&pncm->lfMenuFont, &lfMenuFont, sizeof(LOGFONTA));
                memcpy(&pncm->lfStatusFont, &lfStatusFont, sizeof(LOGFONTA));
                memcpy(&pncm->lfCaptionFont, &lfCaptionFont, sizeof(LOGFONTA));
                memcpy(&pncm->lfSmCaptionFont, &lfSmCaptionFont, sizeof(LOGFONTA));

#else
                memcpy(&pncm->lfMenuFont, &lfMenuFont, offsetof(LOGFONTA, lfFaceName));
                WCSTOMBS_S(pncm->lfMenuFont.lfFaceName, lfMenuFont.lfFaceName, _countof(pncm->lfMenuFont.lfFaceName));

                memcpy(&pncm->lfStatusFont, &lfStatusFont, offsetof(LOGFONTA, lfFaceName));
                WCSTOMBS_S(pncm->lfStatusFont.lfFaceName, lfStatusFont.lfFaceName, _countof(pncm->lfStatusFont.lfFaceName));

                memcpy(&pncm->lfCaptionFont, &lfCaptionFont, offsetof(LOGFONTA, lfFaceName));
                WCSTOMBS_S(pncm->lfCaptionFont.lfFaceName, lfCaptionFont.lfFaceName, _countof(pncm->lfCaptionFont.lfFaceName));

                memcpy(&pncm->lfSmCaptionFont, &lfSmCaptionFont, offsetof(LOGFONTA, lfFaceName));
                WCSTOMBS_S(pncm->lfSmCaptionFont.lfFaceName, lfSmCaptionFont.lfFaceName, _countof(pncm->lfSmCaptionFont.lfFaceName));
#endif
            }
        }
    }

    return bResult;
}

BOOL WINAPI CXTPSkinManagerApiHook::OnHookSystemParametersInfoW(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni)
{
    XTP_SKINFRAMEWORK_MANAGE_STATE();

    CXTPSkinManagerApiFunction* pFunction = EnterHookedCall(xtpSkinApiSystemParametersInfoW);
    if (NULL == pFunction)
    {
        return FALSE;
    }

    typedef BOOL(WINAPI* LPFNSYSTEMPARAMETERSINFO)(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni);
    BOOL bResult = ((LPFNSYSTEMPARAMETERSINFO)pFunction->m_pfnOrig)(uiAction, uiParam, pvParam, fWinIni);

    XTP_GUARD_SHARED_(CXTPSkinManager, XTPSkinManager(), pSkinManager)
    {
        if (!pSkinManager->IsEnabled() || pSkinManager->GetMetrics()->m_bRefreshMetrics)
            return bResult;

        if (!pSkinManager->HasApplyOptions(xtpSkinApplyMetrics | xtpSkinApplyColors | xtpSkinApplyFrame))
            return bResult;

        if (uiAction == SPI_GETICONTITLELOGFONT && uiParam == sizeof(LOGFONTW))
        {
#ifdef _UNICODE
            LOGFONTW* pLogFont = reinterpret_cast<LOGFONTW*>(pvParam);
            ASSERT(NULL != pLogFont);
#else
            LOGFONTA logFont;
            LOGFONTA* pLogFont = &logFont;
#endif

            XTP_GUARD_SHARED_(CXTPSkinManagerSchema, XTPSkinManager()->GetSchema(), pSchema)
            {
                UINT nSysMetrics = pSchema->GetClassCode(_T("SYSMETRICS"));

                pSchema->GetFontProperty(nSysMetrics, 0, 0, TMT_ICONTITLEFONT, *pLogFont);

#ifndef _UNICODE
                LOGFONTW* pLogFontW = reinterpret_cast<LOGFONTW*>(pvParam);
                ASSERT(NULL != pLogFontW);

                memcpy(pLogFontW, pLogFont, offsetof(LOGFONT, lfFaceName));
                MBSTOWCS_S(pLogFontW->lfFaceName, pLogFont->lfFaceName, _countof(pLogFontW->lfFaceName));
#endif
            }
        }

        if (uiAction == SPI_GETNONCLIENTMETRICS && uiParam == sizeof(NONCLIENTMETRICSW))
        {
            XTP_GUARD_SHARED_(CXTPSkinManagerSchema, XTPSkinManager()->GetSchema(), pSchema)
            {
                UINT nSysMetrics = pSchema->GetClassCode(_T("SYSMETRICS"));

                LOGFONT lfMenuFont, lfStatusFont, lfCaptionFont, lfSmCaptionFont;
                pSchema->GetFontProperty(nSysMetrics, 0, 0, TMT_MENUFONT, lfMenuFont);
                pSchema->GetFontProperty(nSysMetrics, 0, 0, TMT_STATUSFONT, lfStatusFont);
                pSchema->GetFontProperty(nSysMetrics, 0, 0, TMT_CAPTIONFONT, lfCaptionFont);
                pSchema->GetFontProperty(nSysMetrics, 0, 0, TMT_SMALLCAPTIONFONT, lfSmCaptionFont);

                NONCLIENTMETRICSW* pncm = reinterpret_cast<NONCLIENTMETRICSW*>(pvParam);
                ASSERT(NULL != pncm);

#ifdef _UNICODE
                memcpy(&pncm->lfMenuFont, &lfMenuFont, sizeof(LOGFONTW));
                memcpy(&pncm->lfStatusFont, &lfStatusFont, sizeof(LOGFONTW));
                memcpy(&pncm->lfCaptionFont, &lfCaptionFont, sizeof(LOGFONTW));
                memcpy(&pncm->lfSmCaptionFont, &lfSmCaptionFont, sizeof(LOGFONTW));

#else
                memcpy(&pncm->lfMenuFont, &lfMenuFont, offsetof(LOGFONTW, lfFaceName));
                MBSTOWCS_S(pncm->lfMenuFont.lfFaceName, lfMenuFont.lfFaceName, _countof(pncm->lfMenuFont.lfFaceName));

                memcpy(&pncm->lfStatusFont, &lfStatusFont, offsetof(LOGFONTW, lfFaceName));
                MBSTOWCS_S(pncm->lfStatusFont.lfFaceName, lfStatusFont.lfFaceName, _countof(pncm->lfStatusFont.lfFaceName));

                memcpy(&pncm->lfCaptionFont, &lfCaptionFont, offsetof(LOGFONTW, lfFaceName));
                MBSTOWCS_S(pncm->lfCaptionFont.lfFaceName, lfCaptionFont.lfFaceName, _countof(pncm->lfCaptionFont.lfFaceName));

                memcpy(&pncm->lfSmCaptionFont, &lfSmCaptionFont, offsetof(LOGFONTW, lfFaceName));
                MBSTOWCS_S(pncm->lfSmCaptionFont.lfFaceName, lfSmCaptionFont.lfFaceName, _countof(pncm->lfSmCaptionFont.lfFaceName));
#endif
            }
        }
    }

    return bResult;
}

Regards,
 Oleksandr Lebed


Posted By: mgampi
Date Posted: 03 January 2018 at 6:03am
Thanks,

I'll try it and report my results later...


-------------
Martin

Product: Xtreme Toolkit v 15.3.1, new Projects v 18.3.0
Platform: Windows 8.1 (64bit)
Language: VC++ 20


Posted By: mgampi
Date Posted: 03 January 2018 at 6:42am
Just tested it and it's ok now! Thumbs Up
I hope this will go soon into 18.3 release. We don't want to maintain XTP code changes and bug fixes.

Many thanks Oleksandr!


-------------
Martin

Product: Xtreme Toolkit v 15.3.1, new Projects v 18.3.0
Platform: Windows 8.1 (64bit)
Language: VC++ 20


Posted By: olebed
Date Posted: 03 January 2018 at 9:15am
Hello Martin,

Thank you for confirmation.
We are working on v18.3, I hope it will be released this month.

Regards,
Oleksandr Lebed


Posted By: mgampi
Date Posted: 11 March 2018 at 2:25pm
Hello;
Have to re-open this post, because when window is maximized the caption is still clipped (see the descender of letters 'y' and 'g') :



Please fix it.

TIA


-------------
Martin

Product: Xtreme Toolkit v 15.3.1, new Projects v 18.3.0
Platform: Windows 8.1 (64bit)
Language: VC++ 20



Print Page | Close Window