Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Skin Framework
  New Posts New Posts RSS Feed - [solved] Bug - Clipped caption text
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

[solved] Bug - Clipped caption text

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

Joined: 14 July 2003
Status: Offline
Points: 1010
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Topic: [solved] Bug - Clipped caption text
    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.0.1
Platform: Windows 8.1 (64bit)
Language: VC++ 2015 U
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1335
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1010
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post 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.0.1
Platform: Windows 8.1 (64bit)
Language: VC++ 2015 U
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1010
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 01 September 2017 at 3:01pm
Still no comment from CJ?
Martin

Product: Xtreme Toolkit v 15.3.1, new Projects v 18.0.1
Platform: Windows 8.1 (64bit)
Language: VC++ 2015 U
Back to Top
olebed View Drop Down
Admin Group
Admin Group
Avatar

Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 654
Post Options Post Options   Thanks (1) Thanks(1)   Quote olebed Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1010
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post 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.0.1
Platform: Windows 8.1 (64bit)
Language: VC++ 2015 U
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1010
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post 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.0.1
Platform: Windows 8.1 (64bit)
Language: VC++ 2015 U
Back to Top
olebed View Drop Down
Admin Group
Admin Group
Avatar

Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 654
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0.082 seconds.