Professional UI Solutions
Site Map   /  Register


Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » Minimal size for a SDI application with a docked ControlBar Collapse All
Subject Author Date
Gregor Jasny Dec 17, 2007 - 4:26 AM


I’ve a SDI Application with a panel which is docked at the bottom. This panel contains a resizable dialog.

When I narrow the vertical size of the app, first the "view" space gets eaten up (as expected). But when no more view space is available, the space is taken from the bottom of the panel. My problem is, that I need to know when portions of my dialog are being obscured/hidden.

If it is "by-design" that docked panels aren’t resized when their parent app is resized, I’d expect that the app has a minimal size which covers the panel completely so that the resizing stops when the view space has reached it’s minimal size (maybe empty).

Do you have any hints for implementing this minimal size thing? I fear it’s rather complex due to all the docking stuff. Have you implemented something similar in a sample?


Technical Support Dec 18, 2007 - 3:35 AM

Thank you for the interesting question. You should handle WM_GETMINMAXINFO in your main frame class so that you can limit its minimum size when resizing. You can get the minimum size using the following code

CMainFrame * pMainFrame = . . .
CRect rcFrameWnd, rcInnerAreaWhichIsFreeOfAnyBars;
      pMainFrame->GetWindowRect( &rcFrameWnd );
      pMainFrame->GetDlgItem( AFX_IDW_PANE_FIRST )->GetWindowRect( &rcInnerAreaWhichIsFreeOfAnyBars );
CSize sizeMainFrame = rcFrameWnd.Size();
CSize sizeSdiViewOrMdiClientArea = rcInnerAreaWhichIsFreeOfAnyBars.Size();
CSize sizeMinimalToShowAllBars = sizeMainFrame - sizeSdiViewOrMdiClientArea;
The sizeMinimalToShowAllBars should be specified as the minimum acceptable size for your main frame window in its OnGetMinMaxInfo() message handler method. The rcInnerAreaWhichIsFreeOfAnyBars rectangle can also be computed using the CWnd::RepositionBars() method with the CWnd::reposQuery constant in one of its parameters.

This approach should meet your requirements if your main frame has only the following type of control bars:

1) The persistently non-redockable control bars like the status bar.

2) The control bar like windows which take up some part of main frame’s client area persistently like MDI tabs and grouped auto-hide areas for resizable control bars.

3) The CExtControlBar and/or CExtDynamicControlBar control bars.

If your main frame window has a CExtMenuControlBar menu control bar, it can re-organize its buttons into a larger number of rows if the menu bar’s width is enough condensed. If you have several CExtToolControlBar tool control bar windows docked into one row, then this row can be converted into 2, 3 and more rows if it’s not possible to layout all the bars in one row. The same is true for vertically a docked menu bar and toolbars andfor CExtPanelControlBar panel bars if you have such bars in your project. This means the sizeMinimalToShowAllBars size value cannot be enough large to fit all bars due to layout behavior of the menu bar and toolbars. You can simply increase it by a few pixels horizontally/vertically so everything will be OK. If you have enough large number of toolbars, then exact computation of the sizeMinimalToShowAllBars is hardly possible.