Click here to Skip to main content
Sign Up to vote bad
good
See more: C++MFCVC10.0
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 11-Feb-11 7:21am
Edited 11-Feb-11 7:36am
TweakBird16.9K


3 solutions

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.
  Permalink  
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 Lindquist - 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... Smile | :)
  Permalink  
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!
  Permalink  

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Christian Graus 545
1 Ron Beyer 316
2 Tadit Dash 233
3 samadhan_kshirsagar 229
4 OriginalGriff 198
0 Sergey Alexandrovich Kryukov 7,061
1 Prasad_Kulkarni 3,815
2 OriginalGriff 3,557
3 _Amy 3,370
4 CPallini 3,034


Advertise | Privacy | Mobile
Web03 | 2.6.130619.1 | Last Updated 28 Feb 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid