Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Bug report: Ribbon group resize problem
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Bug report: Ribbon group resize problem

 Post Reply Post Reply
Author
Message
Jimor Marlow View Drop Down
Groupie
Groupie
Avatar

Joined: 03 June 2007
Location: Russian Federation
Status: Offline
Points: 30
Post Options Post Options   Thanks (0) Thanks(0)   Quote Jimor Marlow Quote  Post ReplyReply Direct Link To This Post Topic: Bug report: Ribbon group resize problem
    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);
     
Back to Top
Jimor Marlow View Drop Down
Groupie
Groupie
Avatar

Joined: 03 June 2007
Location: Russian Federation
Status: Offline
Points: 30
Post Options Post Options   Thanks (0) Thanks(0)   Quote Jimor Marlow Quote  Post ReplyReply Direct Link To This Post Posted: 13 August 2007 at 3:44pm
FYI: Xtreme ToolkitPro v11.1.3
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 14 August 2007 at 1:19am
Hello,
 
Thanks, fixed now.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
sulla138 View Drop Down
Newbie
Newbie


Joined: 09 January 2007
Location: United States
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote sulla138 Quote  Post ReplyReply Direct Link To This Post Posted: 14 August 2007 at 1:49pm
Hi,
We're having the same issue. How can I get your fix?

thanks,
Mike
Back to Top
Jimor Marlow View Drop Down
Groupie
Groupie
Avatar

Joined: 03 June 2007
Location: Russian Federation
Status: Offline
Points: 30
Post Options Post Options   Thanks (0) Thanks(0)   Quote Jimor Marlow Quote  Post ReplyReply Direct Link To This Post 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.
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.152 seconds.