Click here to Skip to main content
15,884,836 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I am developing using VC++ 2010, have an MDI application using tabbed documents using the Ribbon Bar Office 2007 style Fluent UI.

I changed the CMFCRibbonStatusBar to CMFCStatusBar in the Main Frame class (because the extended panel text on the right disappeared when the frame size became smaller than the text - the CMFCStatusBar status bar just truncates the text which is what I needed.)

I also have a status bar for the Child Frame that is a CMFCStatusBar. This status bar is shown and hidden using ShowWindow(SW_SHOW/SW_HIDE). After showing/hiding the status bar, it does not re-display in the child frame until you physically resize the main frame using the resize bars.

I have tried several things after the Show/Hide statement with no joy:

GetParentFrame()->RecalcLayout();
RecalcLayout(); (the child frame gives and unhandled exception because you are not supposed to resize the child frame when tabbed documents are used)
AfxGetMainWnd()->PostMessage(WM_SIZE, 0, 0);
AfxGetMainWnd()->Invalidate();
AfxGetMainWnd()->Redraw();


In the old days of VC++ 6.0 we could use CStatusBar and ShowControlBar() which worked great! Unfortunately, the CStatusBar class does not work when you have the Ribbon Bar so we have to use CMFCStatusBar. The MFC version does not have an equivalent to ShowControlBar()...

Any suggestions would be helpful!
Posted
Updated 11-Feb-11 7:36am
v2

MSDN says you should try CBasePane::ShowPane()[^]

This method shows or hides a pane. Use this method instead of ShowWindow because this method notifies the relevant docking managers about changes in the pane's visibility.
 
Share this answer
 
Comments
Sharon F 11-Feb-11 19:12pm    
This works when hiding but when showing, the program crashes on the first line of the CWnd::MoveWindow() function that is called from AdjustDockinglayout() in CBasePane::ShowPane() with an unhandled exception. (My guess is this is caused when it trys to resize the child frame when tabbed documents are used in an MDI app.)
Niklas L 12-Feb-11 2:42am    
One idea would be to try this in a fresh project, and see if the framework is responsible for this, or if it's any code you added that might be the culprit.
Sharon F 14-Feb-11 13:06pm    
I did try your idea of a fresh project and it seemed to work nicely. I'll keep looking at my code.
You can also change the positions[^] of the frame's components,
so the position rectangle of a bar/view/.. could have its height =0 or not... :)
 
Share this answer
 
Comments
Sharon F 14-Feb-11 13:11pm    
This one seemed to work OK however it left an empty space when it was disabled (0 height). See my solution below - it just needed the size message to get to the right part of the frame work to readjust the child frame. Thank you for your help!
I ended up getting it to work by posting a WM_SIZE message to the ChildFrame just after the Show/Hide.

m_wndChildStatusBar.ShowWindow(SW_SHOW);
PostMessage(WM_SIZE);

Thank you Niklas and Eugen for your helpful suggestions!
 
Share this answer
 
Hi
I don't have an answer but did you resolve this ?

I am using vs2013 and now use cmfcstatusbar too. I overrode the onmdiclienterasebackground to draw my own background and that has caused the same behaviour as you. If I revert to normal program behaviours the status bar shows immediately..
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900