MFC Ribbon Bug - incorrectly calculated panel widths. - by MTtravis

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 653308 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 3/24/2011 6:39:39 AM
Access Restriction Public


I've found a bug that effects both the resource editor and produced code when dealing with Ribbons.  You may already be aware of it but its been driving me nuts so I thought I'd make sure.  I'm working with VS2010 C++ and MFC.    I was prototyping up an interface to see what it would look like to move from a file menu to a ribbon.  I found that if a panel has a title wider than the buttons inside it then the minimum width is still based on the buttons, not the title.  This results in the panel returning an incorrect minimum width value when queried.

This means two things.  The first is that in the produced code the ribbon doesn't calculate the correct category width and doesn't scroll correctly if the window isn't wide enough to display all panels.   More specifically when shrinking the window the panels will at first fall off the right side of the ribbon without reducing them or offering a scrolling option.

I didn't realize this until later when trying to determine the extent of the bug but if you go into the resource view and edit a ribbon - then start making panels with titles wider than their buttons the exact same thing happens.  Panels begin to fall off the right side of the ribbon without it being correctly re-sized to hold them.  

Very annoying - and if I want to bypass it given which functions are and are not virtual I believe I need to inherit classes from both CMFCRibbonPanel and CMFCRibbonCategory - as well as alter the MFC file headers to give my new classes friend access to certain others.   This is an option but not fun as the category that is giving me problems (wider than usual panel names) would normally be created dynamically during run-time depending on data_set selection.  I was planning to inherit my own version of the ribbon category already - to make it  so you can left mouse click and drag the ribbon category rather than using the somewhat clunky scroll buttons - but I wasn't expecting to have to bypass bugs in MFC to get it to work.  

Sign in to post a comment.
Posted by Microsoft on 4/1/2011 at 10:20 AM

Thanks for the report. This issue has been fixed in MFC for the next major release of Visual Studio.

Pat Brenner
Visual C++ Libraries Development
Posted by Microsoft on 3/24/2011 at 7:13 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(