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 » Ribbonbar controlbar docking issue Collapse All
Subject Author Date
Brian Horn Aug 29, 2007 - 4:18 AM

Hi,
We are facing one major issue related to docking of controlbar and ribbonbar, if we create ribbonbar in childframe and controlbar in mainframe. Then controlbar gives docking problem.

We have created one sample application. In this sample when we launch application it shows a controlbar.
1. Press CRTL+N to create child window. Child window will appear on screen along with ribbonbar(we have created ribbonbar in childframe::OnCreateClient.) now try to dock contorlbar to left hand side of window. This will shift ribbonbar to right hand side beyond the borders of window. And ribbonbars controlwindow(maximize, minimize, close) buttons will get disappear.

2. After opening child window press CTRL + 1 that will show controlbar. We want that controlbaraˆ™s top will start from just below the ribbonbar and its bottom should be status bar if no other control bar is present. If another controlbar is already present the that controlbaraˆ™s bottom will be new controlbaraˆ™s Top.

Please find source code on below link. Please click on download button on below link that will transfer control to other page after 10 seconds it will show another download button to download the file)

http://www.MegaShare.com/265155

Brian Horn Sep 7, 2007 - 12:18 PM

Hi,
Thanks for the help. I want this dynamic controlbar should get HIDE, AUTOHIDE and destroy as other normal controlbar.
Can you tell me how to this ?

Technical Support Sep 8, 2007 - 12:54 PM

The dynamic control bars behave exactly like simple control bars except for their support for tabbed/document mode. The hide and auto-hide features are the same. But please note that in order to change the state of a dynamic control bar (hidden, auto-hidden, floating, dockable or tabbed/document), you should use the CExtDynamicControlBar::BarStateSet() method. Unlike the simple control bars, the dynamic bars are always instantiated in dynamic memory. They are allocated using the CExtDynamicBarSite::BarAlloc() method and destroyed using the CExtDynamicBarSite::BarFree() method. We think all these specifics of dynamic control bars do not make them very different.

Brian Horn Sep 4, 2007 - 5:01 AM

Please find the attached file. In this code I tried creating dynamic controlbar. Its covering the entire framewindow. But its not showing the close button. And when I click on ctrl+N then that time this window gets shrink and doesnt get fit in remaining framewindow as it was before pressing CTRL+N

http://rapidshare.com/files/53329171/test1.zip

Technical Support Sep 4, 2007 - 10:25 AM

We added MDI tabs with a close button to each tab in your project to let you close the bars in the document mode. We also added CMyNonAutoHideAbleControlBar::WindowProc() method to fix incorrect references between the HTML view inside a dynamic resizable bar and the main frame window at shutdown. The last problem needs some redesign in your project: it is not good to define the CExtRibbonBar property in the MDI child frame class but create it in the main frame class. We think you should use one ribbon bar control in the main frame class only and re-initialize its content when needed. We sent you a modified version of your project by email.

Brian Horn Sep 4, 2007 - 3:36 AM

Thanks a lot for above answer.

Using object of CExtDynamicControlBar I could able do what I was expecting. Only thing now is I dont want the dropdown menu on right click of TAB name. Can you tell me how to stop that?

Technical Support Sep 4, 2007 - 7:46 AM

Please note that the context menu over the dynamic control bar’s caption and the menu displayed from the drop-down Options button in the same caption is called Window Options menu. If you disabled it, the user will not be able to switch bar states (dockable, floating, and document). To disable this menu, you should make it empty. The empty menu will not be tracked by the control bar. The Window Options menu is constructed in the CExtDynamicControlBar::OnInitDbsMenu() virtual method. The bar caption buttons are initialized in the CExtDynamicControlBar::OnNcAreaButtonsReinitialize() virtual method. So, you should use your own CExtDynamicControlBar-derived class like as follows:

class CYourBar : public CExtDynamicControlBar
{
public:
      DECLARE_SERIAL( CYourBar );
      CYourBar()
      {
      }
      virtual ~CYourBar()
      {
      }
      virtual void OnNcAreaButtonsReinitialize()
      {
            //
            // This method will initialize both the close/hide button and
            // auto-hide pin button but not the window options button.
            //
            ASSERT_VALID( this );
            INT nCountOfNcButtons = NcButtons_GetCount();
            if( nCountOfNcButtons > 0 )
                  return;
            NcButtons_Add( new CExtDynamicBarNcAreaButtonClose(this) );
#if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
            NcButtons_Add( new CExtDynamicBarNcAreaButtonAutoHide(this) );
#endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
            /////// NcButtons_Add( new CExtDynamicBarNcAreaButtonMenu(this) );
      }
      virtual bool OnInitDbsMenu(
            CExtPopupMenuWnd * pPopup,
            HWND hWndTrack,
            CObject * pHelperSrc,
            LPARAM lParamHelper = 0
            )
      {
            //
            // This method will abandon menu construction.
            //
            ASSERT_VALID( this );
            pPopup;
            hWndTrack;
            pHelperSrc;
            lParamHelper;
            return false;
      }
};

IMPLEMENT_SERIAL( CYourBar, CExtDynamicControlBar, VERSIONABLE_SCHEMA|1 );

Brian Horn Sep 2, 2007 - 10:57 PM

I want TOP Controlbar should cover entire client area of framewindow. Please find the images in zip file named 1 & 3.
First image 1 is my requirement if bottom controlbar is present. And please refer image 3 if bottom contorlbar is absent.

I dont want to specify hardcoded values for framewindow. If I specify hardcoded value for setting height of controlbar then on maximizing application TOP Control bar and bottom contorlbar is showing GAP in between them. Please refer image 2 from below zip file.

Even on application maximize the height of TOP controlbar should get automatically set and if bottom contorlbarr is absent then height of top contorlbar must get extended to statusbar of window.

http://rapidshare.com/files/53028073/images.zip

Technical Support Sep 3, 2007 - 11:06 AM

The resizable control bars are designed as windows docked to the borders of the main frame window. They are not designed for covering the entire frame window area. You can use dynamic resizable control bars instead. The dynamic bars can be switched into the tabbed/document mode. So, you can have several bars docked to main frame’s sides and one or more bars switched into the document mode. As a result all the main frame’s area will be covered with control bars. Please see the SDI_DynamicBars sample application for details.

Brian Horn Aug 31, 2007 - 4:19 AM

Thanks for the first answer.

Please find the new updated source code. In this code when you compile and launch the application. Press Ctrl+N that will launch childwindow with ribbonbar. And now press button which is present in quick access button of ribbonbar.

On click this will launch controlbar just below ribbonbar. We want to set the height of this controlbar to be the top of other controlbar( if controlbar is visible). Other wise height should be till statusbar.

Source code link is as below.
http://rapidshare.com/files/52424473/test.zip

And you refer to image for better understanding.
http://rapidshare.com/files/52425915/1.zip

Technical Support Sep 1, 2007 - 11:24 AM

We replaced the following lines in the CMainFrame::OnCreate() method

      m_wndOutput.DockControlBarInnerOuter(AFX_IDW_DOCKBAR_BOTTOM, 1 );
      m_wndWindow.DockControlBarInnerOuter( AFX_IDW_DOCKBAR_LEFT, 2 );
with
     m_wndWindow.SetInitDesiredSizeHorizontal( CSize( 1, 50 ) ); // 50 pixel height
      m_wndWindow.DockControlBarInnerOuter( AFX_IDW_DOCKBAR_TOP, 1 );

      m_wndOutput.SetInitDesiredSizeHorizontal( CSize( 1, 50 ) ); // 50 pixel height
      m_wndOutput.DockControlBarInnerOuter(AFX_IDW_DOCKBAR_BOTTOM, 1 );
Then we commented out the code that loads the control bars’ state and run your application. Both control bars are now 50 pixels in height. One is at top and other is at bottom. Thit mean you can control the height of control bars. Is that what you need?

Technical Support Aug 29, 2007 - 1:43 PM

To fix the problem with control bar’s position, we modified the code at the beginning of the CChildFrame::OnCreateClient() method in your project:

BOOL CChildFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
      // TODO: Add your specialized code here and/or call the base class
      CWinApp* pApp = ::AfxGetApp();
            if(   ! objRibbonBar.m_wndRibbonBar.Create(
                  NULL,
                  ::AfxGetMainWnd()
                  )
            )
      {
            ::AfxMessageBox(_T("Failed"));
            TRACE0("Failed to create the m_wndRibbonBar toolbar\n");
            return -1;      // fail to create
      }

////////////////////////////////////////////////////////////////////////////////////
///                                                                              ///
/// BEGIN:      This code was added.                                             ///
///                                                                              ///

      objRibbonBar.m_wndRibbonBar.SetWindowPos(
            &CWnd::wndTop, 0, 0, 0, 0,
            SWP_NOMOVE|SWP_NOSIZE|SWP_NOREDRAW|SWP_NOSENDCHANGING
            );

///                                                                              ///
///  END:       This code was added.                                             ///
///                                                                              ///
////////////////////////////////////////////////////////////////////////////////////

      objRibbonBar._InitRibbonBar();
. . .
Please provide us with more information about the Ctrl+1 command in your test project. This key combination does nothing when we run your project. We found neither such an accelerator in the resources nor VK_CONTROL constant usage in your source code.