Professional UI Solutions
Site Map   /  Register
 
 

Forum

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 Tech Support » Resizing a docked bar from the program Collapse All
Subject Author Date
Raffaele Cappelli Apr 12, 2006 - 3:11 AM

Is there a way to resize a docked CExtControlBar from the program?

SetInitDesiredSize...() followed by RecalcLayout does something, but only if the bar is on a single row.

Technical Support Apr 12, 2006 - 4:42 AM

If there are more than one control bar in the a row, you need to set a size for each control bar in this row. It is because control bars may affect each other’s size. Please provide us with more details about the layout so that we can help you.

Raffaele Cappelli Apr 12, 2006 - 9:49 AM

What I would like to do is to add a command that attempts to ensure a minimum size for all the dynamic bars that are currently docked.

Technical Support Apr 13, 2006 - 1:55 AM

The CFrameWnd::m_listControlBars property contains a list of all the CControlBar objects in the frame window. You can traverse this list and downcast each control bar to the CExtControlBar type. If CExtControlBar::IsFixedMode() returns true, this bar is typically re-dockable toolbar and you should not review it. If the CControlBar::m_pDockSite property is set to NULL, then the control bar is not enabled for redocking and you should not review it too. The rest of the bars are resizable control bars including dynamic row containers (the CExtDynControlBar class) and dynamic tabbed container bars (the CExtDynTabControlBar class). We guess we may also review bars which are inside simple or complex floating palettes. This can be detected by invoking the GetParentFrame() method of the resizable control bar and analyzing whether it is CControlBar::m_pDockSite. Ok, the rest of bars should be reviewed and checked whether they have a minimal size. First of all, you need to invoke the CExtControlBar::IsDockedHorizontally() method to detect whether the bar is in a horizontal row of bars (or in a vertical column). To get the minimal height of the bar, use the CExtControlBar::_CalcDesiredMinVH() method and to get the minimal width of the bar, use the CExtControlBar::_CalcDesiredMinHW() method. The returned value can be compared with the real sizes of the control bar windows and you can reset the desired sizes to needed less possible. Please note, the default minimal sizes are very small and we recommend you hide some or all of bars instead of resetting their sizes to minimal possible.

Raffaele Cappelli Apr 13, 2006 - 7:18 AM

Thank you for the explanation.
Once I have determined that a bar should be resized, what methos should I call? SetInitDesiredSize...() or another one?

Technical Support Apr 13, 2006 - 12:22 PM

Yes, you need to use the CControlBar::CalcDynamicLayout() API and specify LM_COMMIT as a parameter. For instance, the following code specifies the height of 50 pixels for a horizontally docked resizable bar:

INT nDesired = 50;
pMainFrame->m_wndBarTop.SetInitDesiredSizeHorizontal( CSize( 32767, nDesired ) );
pMainFrame->m_wndBarTop.CalcDynamicLayout( nDesired, LM_HORZDOCK|LM_COMMIT );
pMainFrame->RecalcLayout();