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 CExtControlBar wehn floating Collapse All
Subject Author Date
Offer Har Jan 4, 2007 - 7:36 PM

I have a CExtControlBar bar that i want to resize from the code when it is floating.
I could not find any function to resize in the CExtControlBar, and the CWnd’s MoveWindow had no effect when called.

Please explain how this task can be done.

Technical Support Jan 5, 2007 - 6:46 AM

Here are some additional details in addition to what Chris wrote. You can use the following code:

CSize sz( nWidth, nHeight );
m_wndResizableBar.SetInitDesiredSizeFloating( sz );

CFrameWnd * pFrame = m_wndResizableBar.GetParentFrame();
ASSERT( pFrame );
if( pFrame->IsKindOf( RUNTIME_CLASS( CMiniDockFrameWnd ) ) )
{
	pFrame->RecalcLayout();
	pFrame->SendMessage( WM_NCPAINT ); 
}
Please note that in the code above the layout of control bar’s parent floating mini frame window is forcibly recomputed.

You can also download this small sample that demonstrates how to change the size and position of a floating control bar.

In order to change the size of a docked control bar, you should additionally invoke the CControlBar::CalcDynamicLayout() API and specify LM_COMMIT in its parameter. For instance, the following code specifies the height of 50 pixels for a horizontally docked control bar:
INT nDesired = 50;
pMainFrame->m_wndBarTop.SetInitDesiredSizeHorizontal( CSize( 32767, nDesired ) );
pMainFrame->m_wndBarTop.CalcDynamicLayout( nDesired, LM_HORZDOCK|LM_COMMIT );
pMainFrame->RecalcLayout();

Offer Har Jan 5, 2007 - 7:15 AM

Another question - How do i get the current size and position of the bar?
I would like to change only one parameter - the height, so i need to know the current location and width.

Thanks.

Offer Har Jan 5, 2007 - 8:27 AM

OK - I figured this one out myself:
The position is position of the GetParentFrame() of the CExtControlBar
The size is the size of the CExtControlBar and to it I add my delta:


CFrameWnd* pFrame = pBar->GetParentFrame();

CRect rc;
pFrame->GetWindowRect(rc);
CRect rcBar;
pBar->GetWindowRect(rcBar);

pBar->SetInitDesiredPosFloating(CPoint(rc.left,rc.top));
pBar->SetInitDesiredSizeFloating(CSize(rcBar.Width(),rcBar.Height()+nDelta));
pBar->FloatControlBar(CPoint(rc.left,rc.top));

pFrame->RecalcLayout();
pFrame->SendMessage( WM_NCPAINT );

Offer Har Jan 5, 2007 - 7:07 AM

Thanks for that sample.

In the same context - a while a go i asked for a way to limit the size of a floating bar to certain size (so it won’t get too small), and never got a full answer - Maybe you can re-check this problem?

Thanks.

Technical Support Jan 5, 2007 - 9:30 AM

You need to prevent any mouse actions with regard to the control bar if these actions are based on clicks on the non client area where resizing is performed. So add the WindowProc() virtual method like as follows:

virtual LRESULT CYourControlBar::WindowProc( UINT message, WPARAM wParam, LPARAM lParam )
{
    if( message == WM_NCHITTEST )
    {
        LRESULT lResult = CExtControlBar::WindowProc( message, wParam, lParam );
        switch( lResult )
        {
        case HTBOTTOM: 
        case HTBOTTOMLEFT: 
        case HTBOTTOMRIGHT:
        case HTTOP:
        case HTTOPLEFT:
        case HTTOPRIGHT:
            return HTCLIENT:
        }
    }
    return CExtControlBar::WindowProc( message, wParam, lParam );
}
In addition please override the following two methods of CExtControlBar:
    virtual void _RowResizingStart();
    virtual void _RowRecalcingStart();
That should be enough to prevent the control bar from being resized. Please note this will work only if your control bar is a single floating bar and not docked with other bars.

Offer Har Jan 5, 2007 - 9:34 AM

Thanks, but it is not complete unless it can handle the cases of tabbed or side-by-side or docked bars.

How to solve this problem?

Technical Support Jan 5, 2007 - 10:13 AM

To give you the complete solution (all cases), we need some time. This feature is not supported in Prof-UIS at the moment and any off-hand advice would be incomplete because this relates to core code of control bars.

Offer Har Jan 8, 2007 - 6:36 AM

Dead Support,

I undestand that it is hard for you to implemenet this at the moment, and hope that you’ll find the time in the near future to implement this feature.

However, there is one problem that derive from this probelm into normal bars:
When two bars are tabbed together or docked side-by-side, they parent changes to the docked or tabbed parent. This prevent the progrematically resizing (at the momemnt...)
When one of the tabbed bars is closed, and only one of the two bars is staying open, still you keep for that one bar the same parent. It seems as this is a normal bar that can be resized, but it isn’t because it was once tabbed.
I think that this problem should be solved ASAP, the tab looks as a normal bar, but it does not behave normal...
Prof-UIS should know that this is the last bar in a tabbed array of bars, and roll bar to the normal parent.

Please try to incorprate this change for next version.

Thanks in advance,
Ron

Offer Har Jan 5, 2007 - 10:27 AM

OK,

Please let me know when to expect this feature to be incorporated into Prof-UIS.
At the same time, i would like to remind you the problem of destroying a docked control bar (KillBar) that also is not supported with docked/side-by-side and tabbed bars.

I would really apreciate a prompt solution to both problems, as we really need these features ASAP.

Thanks,
Ron.

Suhai Gyorgy Jan 5, 2007 - 2:31 AM

Really just a guess: When floating, the controlbar’s parent is a CExtMiniDockFrameWnd object, and when user resizes the floating controlbar, it is really the CExtMiniDockFrameWnd that is being resized and the controlbar is set to grow/shrink with it. So my guess would be that your code should resize this MiniDockFrameWnd, the controlbar’s parent. CExtMiniDockFrameWnd is derived from CMiniDockFrameWnd, which in turn is derived from CMiniFrameWnd, which is documented in MSDN, although very briefly.