Print Page | Close Window

Bug report: Ribbon group resize problem

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=7786
Printed Date: 24 April 2024 at 11:44pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Bug report: Ribbon group resize problem
Posted By: Jimor Marlow
Subject: Bug report: Ribbon group resize problem
Date Posted: 13 August 2007 at 3:40pm
I'm afraid I've found the bug in ribbon group reduce logic for gallery and button.

You can see this in RibbonSample. Just add simple button before styles gallery control, f.e.:

MainFrm.cpp, ln.598:
BOOL CMainFrame::CreateRibbonBar() {
...
CXTPRibbonGroup* pGroupStyles = pTabHome->AddGroup(ID_GROUP_STYLES);
     
pGroupStyles->Add(xtpControlButton, ID_CHAR_ITALIC); // <- Resize bug when reducing

pControlGallery = (CXTPControlGallery*)pGroupStyles->Add(new CXTPControlGallery(), ID_GALLERY_STYLES);     

...
}

add any simple button, run app, and start to reduce width of main frame. When styles group start to reduce its width you'll get stuck in the endless loop, trying to reduce group size in the
BOOL CXTPRibbonGroup::OnReduceSize(int nLevel){
...
do
{
bReduced = FALSE;

for (int nLevel = 0; nLevel < 4; nLevel++)
{
    for (int i = GetCount() - 1; i >= 0; i--)
    {
      CXTPRibbonGroup* pGroup = GetAt(i);
      if (!pGroup->IsVisible())
        continue;

      if (pGroup->OnReduceSize(nLevel)) // ln.754, here the bug,
      // on nLevel=2, this procedure still signaled TRUE,
      // like it successfully reduced, instead of fail.
      {
        pWidth = pGroup->OnCalcDynamicSize(pDC);
        bReduced = TRUE;
        break;
      }
    }

    if (bReduced)
      break;
    }

    if (bReduced)
    {
      nResult = _CalcSmartLayoutToolBar(pWidth);
      if (nResult < nWidth)
        return;
    }
}
while (bReduced);
}

Fix it, please.

I've forund workaround for current code forewhile:
add button after gallery and SetBeginGroup(TRUE) for button (important condition!). In this case all works fine.

f.e:
// BOOL CMainFrame::CreateRibbonBar(), ln.~618
pGroupStyles->Add(xtpControlButtonPopup, ID_STYLES_CHANGE);
pGroupStyles->Add(xtpControlButton, ID_CHAR_ITALIC)->SetBeginGroup(TRUE); // workaround for resize bug

CXTPRibbonGroup* pGroupFind = pTabHome->AddGroup(ID_GROUP_FIND);
     



Replies:
Posted By: Jimor Marlow
Date Posted: 13 August 2007 at 3:44pm
FYI: Xtreme ToolkitPro v11.1.3


Posted By: Oleg
Date Posted: 14 August 2007 at 1:19am
Hello,
 
Thanks, fixed now.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: sulla138
Date Posted: 14 August 2007 at 1:49pm
Hi,
We're having the same issue. How can I get your fix?

thanks,
Mike


Posted By: Jimor Marlow
Date Posted: 14 August 2007 at 6:37pm
I think we should wait for fixed release. But forewhile you can use workaround I’ve wrote above:
Move all button after galley, and specify the first button as start of new group (btn->SetBeginGroup(TRUE)).

My sample:

BOOL CMainFrame::AddWindowArrangeGroup(CXTPRibbonTab* pTab)
{
    ASSERT( pTab );
    CXTPRibbonGroup* pGroup = pTab->AddGroup( ID_GALLERY_WINDOWS/*"Window"*/ );

    // Галерея выбора размеров сплита
    CXTPControlGallery* pControlGallery = (CXTPControlGallery*)pGroup->Add(new CXTPControlGallery(), ID_GALLERY_WINDOWS);     
    pControlGallery->SetControlSize(CSize(235, 60));
    pControlGallery->SetItemsMargin(0, 1, 0, 1);
    pControlGallery->ShowLabels(FALSE);
    pControlGallery->ShowBorders(TRUE);
    pControlGallery->SetItems(m_pItemsWindowsSplit);

    CMenu menuQuickStyles;
    menuQuickStyles.LoadMenu(ID_WINDOWS_SPLIT_QUICKWINDOWS);

    CXTPPopupBar* pPopupBar = CXTPPopupBar::CreatePopupBar(GetCommandBars());
    pPopupBar->LoadMenu(menuQuickStyles.GetSubMenu(0));

    pControlGallery->SetCommandBar(pPopupBar);
    pPopupBar->EnableAnimation();
    pPopupBar->InternalRelease();

// WORKAROUND: Buttons moved here
    pGroup->Add(xtpControlButton, ID_WINDOW_CASCADE)->SetBeginGroup(TRUE); // <- Don’t foreget to set begin group!!!
    pGroup->Add(xtpControlButton, ID_WINDOW_ARRANGE);
    
    return TRUE;
}


It's work fine.



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