0

I have added Ribbon to an existing MFC application.

The ribbon is created using the Editor.

In one of the panel I have a Custom CMFCRibbonGallery (derived from) whose contents (icon) I change dynamically. (It is much like the Styles Gallery in Excel.

  1. After every time I change the contents I call ForceRecalcLayout which most of the time results in an Assert usually on m_pHighlighted or m_pPressed. Please see the attached snaphot1.jpeg, this Assert happened while I was moving the mouse over the Ribbon Gallery elements (Expanded mode popup) while ForceRecalcLayout was called.
  2. On a different use case if I add the Sub Item (like we have "New Cell Style" in Styles Gallery of Excel) to the QAT using the context menu and then try to create a New cell style I get an Assert on the CMFCRibbonButton. Refer snapshot2.jpg
xMRi
  • 14,982
  • 3
  • 26
  • 59
  • i didn't use any ForceRecalcLayout in the code I'm working on, I've always used the CMFCRibbonBar::RecalcLayout method and it worked on anything I've done so far, maybe it is not right but it works =) also, where are those snapshots, I can't see them in your post – Robson Dec 16 '14 at 09:30

1 Answers1

0

When just the icon changes it is sufficient to invalidate the ribbon.

Only if the size of the individual items are changed you Need to call RecalcLayout.

I see no reason to call ForceRecalsLayout.

xMRi
  • 14,982
  • 3
  • 26
  • 59