Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - [solved] Ribbon "LoadCommandBars" bug
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

[solved] Ribbon "LoadCommandBars" bug

 Post Reply Post Reply
Author
Message
hiro-ta View Drop Down
Groupie
Groupie


Joined: 11 July 2013
Status: Offline
Points: 61
Post Options Post Options   Thanks (1) Thanks(1)   Quote hiro-ta Quote  Post ReplyReply Direct Link To This Post Topic: [solved] Ribbon "LoadCommandBars" bug
    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++) 

Back to Top
olebed View Drop Down
Admin Group
Admin Group


Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
moser@dsd.at View Drop Down
Newbie
Newbie


Joined: 24 October 2007
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote moser@dsd.at Quote  Post ReplyReply Direct Link To This Post 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 ?
Back to Top
olebed View Drop Down
Admin Group
Admin Group


Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
hiro-ta View Drop Down
Groupie
Groupie


Joined: 11 July 2013
Status: Offline
Points: 61
Post Options Post Options   Thanks (0) Thanks(0)   Quote hiro-ta Quote  Post ReplyReply Direct Link To This Post Posted: 06 February 2017 at 3:12am
This problem is occurring among many users. I'm worried.
I want you to fix it soon.
Back to Top
olebed View Drop Down
Admin Group
Admin Group


Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
olebed View Drop Down
Admin Group
Admin Group


Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post 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;
}
Back to Top
olebed View Drop Down
Admin Group
Admin Group


Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post 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);
...
Back to Top
hiro-ta View Drop Down
Groupie
Groupie


Joined: 11 July 2013
Status: Offline
Points: 61
Post Options Post Options   Thanks (0) Thanks(0)   Quote hiro-ta Quote  Post ReplyReply Direct Link To This Post Posted: 10 February 2017 at 2:50am
Hi, 
Thank you for your response. It works well.
Problem solved.
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.172 seconds.