Print Page | Close Window

[solved] Ribbon "LoadCommandBars" bug

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=23212
Printed Date: 26 April 2024 at 12:07am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: [solved] Ribbon "LoadCommandBars" bug
Posted By: hiro-ta
Subject: [solved] Ribbon "LoadCommandBars" bug
Date Posted: 28 November 2016 at 2:13am
Hi,
If you call "LoadCommandBars" or "SaveCommandBars" with the display scaling set to 150%, the ribbon display will be buggy.(See attached image)

●How to reproduce

1. Please set Windows "display scaling" to 150%

2. Open the project "RibbonSample" at VisualStudio 2010.

3. Call "LoadCommandBars" on "CMainFrame::OnCreate()" and Call "SaveCommandBars" on "CMainFrame::OnClose()"
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
       :
LoadCommandBars(_PROFILE_NAME);
       :
}

void CMainFrame::OnClose() 
{
SaveCommandBars(_PROFILE_NAME);
:
}

4.Build and start.

5.Repeat start and exit.

6.Although it is normally displayed at the first startup, it is strange after the second time.(See attached image)

#It might only be reproduced on Japanese version Windows.







Product: Xtreme ToolkitPro (17.3.0) 
Platform: Windows 7/8.1/10 Japanese (x64)
Language: Visual Studio 2010 (C++) 




Replies:
Posted By: olebed
Date Posted: 29 November 2016 at 12:34pm
Hello,

Thank you to bringing this to our attention. I can reproduce this also with Visual Studio 2015 and 125% DPI. I will try to fix.

Regards,
 Oleksandr Lebed


Posted By: moser@dsd.at
Date Posted: 23 January 2017 at 4:23pm
I have the same problem and want to use version 17.3 but we need this issue fixed. Can you tell me when we can expect a solution for this problem ? Is there a workaround without loosing the ability to save customized command bars ?


Posted By: olebed
Date Posted: 23 January 2017 at 9:50pm
Hello moser@dsd.at,

If solution is easy I will write it here. We added this task for next release - v18.0.

Regards,
 Oleksandr Lebed


Posted By: hiro-ta
Date Posted: 06 February 2017 at 3:12am
This problem is occurring among many users. I'm worried.
I want you to fix it soon.


Posted By: olebed
Date Posted: 07 February 2017 at 3:37am
Hello,

I'm glad to inform you about solution.
The changes in file  Source\Common\XTPPropExchange.cpp
BOOL AFX_CDECL PX_DPI_X_Int(CXTPPropExchange* pPX, LPCTSTR pszPropName, int& nValue)
{
    ASSERT_POINTER(pPX, CXTPPropExchange);
    ASSERT_POINTER(&nValue, int);
    if (!pPX)
        return FALSE;

    BOOL bResult;
    int val;
    if (pPX->IsLoading())
    {
        bResult = pPX->ExchangeProp(pszPropName, VT_I4, &val);
        if (bResult)
        {
            nValue = XTP_DPI_X(val);
        }
    }
    else
    {
        val = XTP_UNDPI_X(nValue);
        bResult = pPX->ExchangeProp(pszPropName, VT_I4, &val);
    }

    return bResult;
}

BOOL AFX_CDECL PX_DPI_X_Int(CXTPPropExchange* pPX, LPCTSTR pszPropName, int& nValue,
    int nDefault)
{
    ASSERT_POINTER(pPX, CXTPPropExchange);
    ASSERT_POINTER(&nValue, int);
    if (!pPX)
        return FALSE;

    BOOL bResult;
    int val;
    if (pPX->IsLoading())
    {
        bResult = pPX->ExchangeProp(pszPropName, VT_I4, &val, &nDefault);
        if (bResult)
        {
            nValue = XTP_DPI_X(val);
        }
    }
    else
    {
        val = XTP_UNDPI_X(nValue);
        bResult = pPX->ExchangeProp(pszPropName, VT_I4, &val);
    }

    return bResult;
}

BOOL AFX_CDECL PX_DPI_Y_Int(CXTPPropExchange* pPX, LPCTSTR pszPropName, int& nValue)
{
    ASSERT_POINTER(pPX, CXTPPropExchange);
    ASSERT_POINTER(&nValue, int);
    if (!pPX)
        return FALSE;

    BOOL bResult;
    int val;
    if (pPX->IsLoading())
    {
        bResult = pPX->ExchangeProp(pszPropName, VT_I4, &val);
        if (bResult)
        {
            nValue = XTP_DPI_Y(val);
        }
    }
    else
    {
        val = XTP_UNDPI_Y(nValue);
        bResult = pPX->ExchangeProp(pszPropName, VT_I4, &val);
    }

    return bResult;
}

BOOL AFX_CDECL PX_DPI_Y_Int(CXTPPropExchange* pPX, LPCTSTR pszPropName, int& nValue,
    int nDefault)
{
    ASSERT_POINTER(pPX, CXTPPropExchange);
    ASSERT_POINTER(&nValue, int);
    if (!pPX)
        return FALSE;

    BOOL bResult;
    int val;
    if (pPX->IsLoading())
    {
        bResult = pPX->ExchangeProp(pszPropName, VT_I4, &val, &nDefault);
        if (bResult)
        {
            nValue = XTP_DPI_Y(val);
        }
    }
    else
    {
        val = XTP_UNDPI_Y(nValue);
        bResult = pPX->ExchangeProp(pszPropName, VT_I4, &val);
    }

    return bResult;
}


Fix will be available in next v18.0.

Regards,
 Oleksanrd Lebed


Posted By: olebed
Date Posted: 07 February 2017 at 4:42am
The same with methods PX_DPI_Size, PX_DPI_Point and PX_DPI_Rect
BOOL AFX_CDECL PX_DPI_Size(CXTPPropExchange* pPX, LPCTSTR pszPropName, SIZE& szValue, SIZE szDefault)
{
    ASSERT_POINTER(pPX, CXTPPropExchange);
    if (!pPX)
        return FALSE;

    BOOL bResult;
    SIZE szTempValue;
    if (pPX->IsLoading())
    {
        bResult = pPX->ExchangeProp(pszPropName, VT_EX_SIZE, &szTempValue, &szDefault);
        if (bResult)
        {
            szValue = XTP_DPI(szTempValue);
        }
    }
    else
    {
        szTempValue = XTP_UNDPI(szValue);
        bResult = pPX->ExchangeProp(pszPropName, VT_EX_SIZE, &szTempValue, &szDefault);
    }

    return bResult;
}

BOOL AFX_CDECL PX_DPI_Point(CXTPPropExchange* pPX, LPCTSTR pszPropName, POINT& ptValue, POINT ptDefault)
{
    ASSERT_POINTER(pPX, CXTPPropExchange);
    ASSERT(sizeof(POINT) == sizeof(SIZE));
    if (!pPX)
        return FALSE;

    BOOL bResult;
    POINT ptTempValue;
    if (pPX->IsLoading())
    {
        bResult = pPX->ExchangeProp(pszPropName, VT_EX_SIZE, &ptTempValue, &ptDefault);
        if (bResult)
        {
            ptValue = XTP_DPI(ptTempValue);
        }
    }
    else
    {
        ptTempValue = XTP_UNDPI(ptValue);
        bResult = pPX->ExchangeProp(pszPropName, VT_EX_SIZE, &ptTempValue, &ptDefault);
    }

    return bResult;
}

BOOL AFX_CDECL PX_DPI_Rect(CXTPPropExchange* pPX, LPCTSTR pszPropName, RECT& rcValue, RECT rcDefault)
{
    ASSERT_POINTER(pPX, CXTPPropExchange);
    if (!pPX)
        return FALSE;

    BOOL bResult;
    RECT rcTempValue;
    if (pPX->IsLoading())
    {
        bResult = pPX->ExchangeProp(pszPropName, VT_EX_RECT, &rcTempValue, &rcDefault);
        if (bResult)
        {
            rcValue = XTP_DPI(rcTempValue);
        }
    }
    else
    {
        if (CW_USEDEFAULT != rcValue.left 
            || CW_USEDEFAULT != rcValue.top 
            || CW_USEDEFAULT != rcValue.right 
            || CW_USEDEFAULT != rcValue.bottom) 
        {
            rcTempValue = XTP_UNDPI(rcValue);
        }
        else
        {
            rcTempValue = rcValue;
        }

        bResult = pPX->ExchangeProp(pszPropName, VT_EX_RECT, &rcTempValue, &rcDefault);
    }

    return bResult;
}


Posted By: olebed
Date Posted: 07 February 2017 at 4:47am
also similar fix in CXTPControlComboBox::DoPropExchange 
void CXTPControlComboBox::DoPropExchange(CXTPPropExchange* pPX)
{
    CXTPControlPopup::DoPropExchange(pPX);

    PX_Bool(pPX, _T("DropDown"), m_bDropDown, TRUE);
//    PX_DPI_X_Int(pPX, _T("Width"), m_nWidth, 0);
    PX_Enum(pPX, _T("ComboStyle"), m_comboStyle, xtpComboNormal);
...


Posted By: hiro-ta
Date Posted: 10 February 2017 at 2:50am
Hi, 
Thank you for your response. It works well.
Problem solved.



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