Home Dashboard Directory Help
Search

could CMFCStatusBar RecalcLayout() become virtual? by Marc_75


Status: 

Closed
 as Fixed Help for as Fixed


1
0
Sign in
to vote
Type: Suggestion
ID: 641672
Opened: 2/7/2011 12:56:55 AM
Access Restriction: Public
0
Workaround(s)
view

Description

Hi,

our applications are using the CMFCStatusBar functionality which works great!
However, we currently are using a custom statusbar (overridden from CMFCStatusBar) to allow custom controls (mostly CStatic derivates) be positioned on it.

MFC calculates the pane positions inside the status bar. We create custom CStatic windows to be positioned in side one or more individual panes. Therefore, we will reposition these controls to the corresponding pane size and position.

MFC internally calls CMFCStatusBar::RecalcLayout each time the layout should be recalculated. At this point, it would be great to reposition our custom CStatic controls to the new pane sizes and positions. Unfortunately, CMFCStatusBar::RecalcLayout() is not implemented as 'virtual' function.

currently we are using the following workaround:
override the function CMyMFCStatusBar::DoPaint()
{
PositionControls(); // reposition our custom CStatic controls since we don't known if the controls have been repositioned in the mean time
CMFCStatusBar::DoPaint(pDCPaint);
}
Details
Sign in to post a comment.
Posted by Marc_75 on 2/10/2011 at 11:45 PM
Hi Pat,

you are absolutely right! I didn't notice it since it was declared without the virtual keyword in the CMFCStatusBar class. Therefore, I didn't even try it. Thanks for pointing me into the right direction and for adding the virtual keyword for the next release to let this issue become more obvious.

I love the new MFC classes, you did a great job and are doing great work!
Thanks!

Marc
Posted by Microsoft on 2/10/2011 at 9:24 AM
Hello Marc,

Thanks for the report. I investigated and found that CMFCStatusBar::RecalcLayout actually is virtual, because CMFCStatusBar derives from CPane (which derives from CBasePane) and CBasePane::RecalcLayout is already marked as virtual. I made this explicit by marking CMFCStatusBar::RecalcLayout as virtual in afxstatusbar.h, but your virtual RecalcLayout method should be called in your scenario.

Pat Brenner
Visual C++ Libraries Development
Posted by Microsoft on 2/7/2011 at 12:58 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.