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 General Discussion » Dynamic Control bar - BringWindowToTop() Collapse All
Subject Author Date
Keyur Bhatnagar Jul 12, 2010 - 8:42 AM

Hi,


I have a lot of Control Bars in my application. I am trying to bring up a control bar when i recieve an event associated with it.


I used the following approaches:-


1. Call the ShowControlBar() in my CFrameWnd class, but then if the control bar is already on the top, it dissapears for a second and then comes back.


2. If i use the controlbar’s BringWindowTpTop() it comes to the top but if the control bar is docked with some other control bars, only the dilog comes to the top and the selected Tab and the caption does not change.


Can anyone help me with this? Thanks in Advance.


-Keyur

Keyur Bhatnagar Jul 12, 2010 - 12:06 PM

The above code only works when the control bar is not displayed. If it iss displayed the code hides it, also if it is docked, it removes the tab.

Technical Support Jul 13, 2010 - 3:26 AM

You are using toolbar style commands for resizable control bars. I.e. each resizable control bar related command switches the bar visibility. This means you should check whether the bar is visible before sending WM_COMMAND message. The CControlBar::IsVisible() API checks visibility of single control bar which is not in the tabbed group of bars and not auto-hidden. Which Prof-UIS version are you using? Whether the tabbed bar groups are present in your app?
The auto-hiding feature should be disabled in your app because it requires Visual Studio .NET / 2005 / 2008 / 2010 style of resizable bar commands when each command only shows and focuses resizable bar.
Generally, the control bar activation code should look like:

#if ( ! defined __EXT_MFC_NO_TAB_CONTROLBARS )
            #if ( ! defined __EXT_CONTROLBAR_TABBED_FEATURES_H )
                        #include <../Src/ExtControlBarTabbedFeatures.h>
            #endif
#endif

. . .

CFrameWnd * pMainFrame = . . .
CExtControlBar * pBar = . . .
UINT nBarDlgCtrlID = UINT( pBar->GetDlgCtrlID() );
bool bBarActivated = false;

#if ( ! defined __EXT_MFC_NO_TAB_CONTROLBARS )
            if( pBar->AutoHideModeGet() )
            {
                        pMainFrame->SendMessage( WM_COMMAND, WPARAM(nBarDlgCtrlID) );
                        bBarActivated = true;
            }
            else
            {
                        CExtDynTabControlBar * pTabBar = _GetNearestTabbedContainer();
                        if( pTabBar != NULL )
                        {
                                    LONG nSelectedTabNo = pTabBar->GetSwitcherSelection();
                                    if( nSelectedTabNo >= 0L )
                                    {
                                                CExtControlBar * pSelectedBar = pTabBar->GetBarAt( nSelectedTabNo );
                                                if( LPOVID(pBar) == LPVOID(pSelectedBar) )
                                                {
                                                            CWnd * pWndBarChild = pBar->GetWindow( GW_CHILD );
                                                            if( pWndBarChild->GetSafeHwnd() != NULL )
                                                                        pWndBarChild->SetFocus();
                                                            bBarActivated = true;
                                                }
                                    }
                        }
            }
#endif

            if( ! bBarActivated )
            {
                        if( ! pBar->IsVisible() )
                                    pMainFrame->SendMessage( WM_COMMAND, WPARAM(nBarDlgCtrlID) );
                        else
                        {
                                    CWnd * pWndBarChild = pBar->GetWindow( GW_CHILD );
                                    if( pWndBarChild->GetSafeHwnd() != NULL )
                                                pWndBarChild->SetFocus();
                        }
                        bBarActivated = true;
            }
                        
            return bBarActivated;


Technical Support Jul 12, 2010 - 11:39 AM

The following code activates any resizable control bar in any state and brings it to top:

CFrameWnd * pMainFrame = . . .
CExtControlBar * pBar = . . .
            pMainFrame->SendMessage( WM_COMMAND, WPARAM(pBar->GetDlgCtrlID()) );