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 » Bug in save state of docked bars Collapse All
Subject Author Date
Offer Har Feb 24, 2009 - 9:04 AM

Dear Support,


I dock two dialogs side by side, on the bottom of the main frame, and drag the border between them so the left’s one is aporx. 25% of the common width, and the right one get aprox. 75% of the common width:



+-----------------------------------------+
|										 |
|										 |
|										 |
|										 |
|										 |
+---------------------------+-------------+
|						   |			 |
|						   |			 |
+---------------------------+-------------+


When I exit and re-run the application, the 2 dialogs are docked at the bottom, but each one get 50% of the common width - it did not remember the different width I gave each one of the dialogs:



+-----------------------------------------+
|										 |
|										 |
|										 |
|										 |
|										 |
+--------------------+--------------------+
|				    |				    |
|				    |				    |
+--------------------+--------------------+


Please fix.


Thanks,


Ron.

Offer Har Feb 24, 2009 - 9:06 AM

Well... the preview does not look like the submitted post... but I hope you understand the problem.

Technical Support Feb 24, 2009 - 1:12 PM

Please show the source code you used for docking control bars side by side.

If you compile and run the MDI sample application, then you will see the Bar 1 and Bar 3 bars at the bottom side of the main frame window. You can re-dock them into one row or column and change their mutually dependent sizes. The sizes are restored after restarting this sample application. The following part of the CMainFrame::OnCreate() method in this sample application is responsible for initial bar docking and loading bar states:

   if(         ! CExtControlBar::ProfileBarStateLoad(
                                    this,
                                    pApp->m_pszRegistryKey,
                                    pApp->m_pszProfileName,
                                    pApp->m_pszProfileName,
                                    &m_dataFrameWP
                                    )
                        )
            {
                        DockControlBar(&m_wndMenuBar);
                        DockControlBar(&m_wndToolBar);
                        DockControlBar(&m_wndToolBarUiLook,AFX_IDW_DOCKBAR_RIGHT);
                        m_wndResizableBar0.SetInitDesiredSizeVertical( CSize(80,80) );
                        m_wndResizableBar1.SetInitDesiredSizeHorizontal( CSize(80,80) );
                        m_wndResizableBar2.SetInitDesiredSizeVertical( CSize(80,80) );
                        m_wndResizableBar3.SetInitDesiredSizeHorizontal( CSize(80,80) );
                        m_wndResizableBar4.SetInitDesiredSizeVertical( CSize(80,80) );
                        m_wndResizableBar0.DockControlBar(AFX_IDW_DOCKBAR_LEFT,1,this,false);
                        m_wndResizableBar1.DockControlBar(AFX_IDW_DOCKBAR_BOTTOM,2,this,false);
                        m_wndResizableBar2.DockControlBar(AFX_IDW_DOCKBAR_LEFT,3,this,false);
                        m_wndResizableBar3.DockControlBar(AFX_IDW_DOCKBAR_BOTTOM,4,this,false);
                        m_wndResizableBar4.DockControlBar(AFX_IDW_DOCKBAR_LEFT,5,this,false);
                        m_wndResizableBarTA.DockControlBar(AFX_IDW_DOCKBAR_RIGHT,1,this,false);
                        RecalcLayout();
            }

We can modify this code snippet and replace the following line:
m_wndResizableBar2.DockControlBar(AFX_IDW_DOCKBAR_LEFT,3,this,false);

With the following code:
RecalcLayout();
m_wndResizableBar3.DockControlBarLTRB(&m_wndResizableBar1,AFX_IDW_DOCKBAR_RIGHT,true); 

After removing the HKEY_CURRENT_USER\Software\Foss\MDI registry key and restarting the sample application you will see two bars programmatically docked into one row at the bottom side of the main frame window. You can change their sizes and they will be restored OK.

Offer Har Feb 24, 2009 - 1:17 PM

Dear Support,


I do not dock them side-by-side in the code, but at run time.


My assumption was that this setting will be saved, and when I re-load the application, the layout, and the size each bar occupies will be remembered.


Insead, when I re-load the application, each bar gets 50% instead of the setting it had before it was closed.


 

Technical Support Feb 25, 2009 - 6:22 AM

We are sorry but could you provide some step by step description of what we should do in the MDI sample application to reproduce this issue?

Offer Har Feb 25, 2009 - 8:25 AM

I am sending you an example from the MDI application via mail.

Technical Support Mar 1, 2009 - 4:52 AM

We successfully reproduced this problem. We found only temporarily and experimental solution to this problem. To try it please find the CExtControlBar::InternalDockStateSite::StateSet() method in the .../Prof-UIS/Src/ExtControlBar.cpp file. You can see the if( bPresetWP ) { . . . } conditional code statement at the at the beginning of this method. Please replace it with the following:

 if( bPresetWP )
      {
            CRect rcDockSiteWnd;
            if(         m_wp.showCmd == SW_SHOWMAXIMIZED
                  ||    m_wp.showCmd == SW_SHOWMINIMIZED
                  ||    m_wp.showCmd == SW_SHOWMINNOACTIVE
                  ||    m_wp.showCmd == SW_HIDE
                  ||    m_wp.showCmd == SW_FORCEMINIMIZE
                  )
            {
                  CExtPaintManager::monitor_parms_t _mp;
                  CExtPaintManager::stat_GetMonitorParms( _mp, m_wp.rcNormalPosition );
                  rcDockSiteWnd = _mp.m_rcWorkArea;
            }
            else
                  rcDockSiteWnd =  m_wp.rcNormalPosition;
            CWnd * pWndPlacement = CExtControlBar::stat_GetWndForPlacement( m_pDockSite );
            ASSERT_VALID( pWndPlacement );
            if( pWndPlacement != m_pDockSite )
                  m_pDockSite->SetWindowPos(
                        NULL, 0, 0, rcDockSiteWnd.Width(), rcDockSiteWnd.Height(),
                        SWP_NOZORDER|SWP_NOOWNERZORDER|SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOREDRAW // |SWP_NOSENDCHANGING 
                        );
            pWndPlacement->SetWindowPlacement( &m_wp ); // THIS IS THE REALLY IMPORTANT LINE AND IT DOES FIX
      } // if( bPresetWP )

Now the problem with the size of restored bars is gone. But another new problem is potentially appeared. The code snipped above is invoked when the CMainFrame::OnCreate() method invokes the CExtControlBar::ProfileBarStateLoad() static method for loading bar states and WINDOWPLACEMENT data structure that is used later in the CMainFrame::ActivateFrame() virtual method. So, previously the placement of the main frame window was restored in the CMainFrame::ActivateFrame() virtual method which is typically invoked after complete UI initialization. But now, after the experimental fix listed above is applied, the placement of the main frame window is invoked inside the CExtControlBar::ProfileBarStateLoad() static method and the CMainFrame::OnCreate() method do some final UI initialization after restoring bars. This may be not good for some applications which have long and heavy UI initialization and does not expect the main frame window to appear on the screen before the CMainFrame::ActivateFrame() virtual method is invoked. What we need is the Win32 API similar to the SetWindowPlacement() API but not displaying window on the screen. Very unfortunately, we don’t know such API.

In fact, the fix provided above is the same as manual loading of the main frame’s window placement before loading bar states.



Offer Har Feb 24, 2009 - 9:05 AM

It some how messed the diagrams, another try:


Dear Support,


I dock two dialogs side by side, on the bottom of the main frame, and drag the border between them so the left’s one is aporx. 25% of the common width, and the right one get aprox. 75% of the common width:


+-----------------------------------------+
|										 |
|										 |
|										 |
|										 |
|										 |
+---------------------------+-------------+
|						   |			 |
|						   |			 |
+---------------------------+-------------+

 


When I exit and re-run the application, the 2 dialogs are docked at the bottom, but each one get 50% of the common width - it did not remember the different width I gave each one of the dialogs:


+-----------------------------------------+
|										 |
|										 |
|										 |
|										 |
|										 |
+--------------------+--------------------+
|				    |				    |
|				    |				    |
+--------------------+--------------------+

Please fix.


Thanks,


Ron.