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 » two questions about CExtControBar Collapse All
Subject Author Date
Adam chen Feb 26, 2009 - 7:23 PM

hi experts, I have two questions about CExtControBar, thanks for your help.




   1. I have more than three controlbars with style of CBRS_ALIGN_ANY in MDI project. The controlbars may be docked to any border of the mainframe or docked to each other, so they accupy some rects of the mainframe clientrect and I want to get the rest rect of the clientrect for othe childviews to align. So does prof-UIS have a function to get the rect  I want?


   2. if we do have the function to get the rest of the clientrect, when I change the docked state, I mean if i change the controlbar’s state from floating to docked to the borader or from docked to the border to floating state, I have to recalculate the rest of the client rect and reposition all the childviews, So what event can I use when the controlbar docked state changes?and then I will add the recalculate rect code there.


Thanks very much for your help!

Adam chen Feb 28, 2009 - 8:58 AM

Hi experts, Thanks for your reply. I just tested the code of your suggestions 1)a and 1)b. But it seems something wrong with both two methods. I only add the function below to MDI sample downloaded from your website and set breakpoint to trace the rc value. if no bar is docked to the top of the client area, the rc.top value after this->RepositionBars is 83(it should be 0,isn’t it?why we get this value 83?). if we dock bar at the top of the client area ,the value will be strange if the top docked bar’s heigth is different.


thanks again for your help, i’m just waiting online to here your new suggestion.


void CMainFrame::OnTesthereTestmenuitem() {  CRect rc;  this->GetClientRect( &rc );  this->RepositionBars( 0, 0xFFFF, AFX_IDW_PANE_FIRST, CWnd::reposQuery, &rc, &rc ); /*   CRect rc;  this->GetDlgItem( AFX_IDW_PANE_FIRST )->GetWindowRect( &rc );  this->ScreenToClient( &rc ); */ }

Technical Support Mar 1, 2009 - 4:48 AM

We suspect some of bars were hidden with the delayed layout recalculation before your invoked the code we suggest in our previous answer. Please try to invoke the pMainFrame->RecalcLayout(); line of code first, and then invoke code 1a or 1b. Of course, if there are no bars at top, then the RECT::top property should be zero. Please also note, the auto-hide area with grouped tabs and the MDI tabs control are also allocating required space inside the main frame window like control bars do.

Technical Support Feb 28, 2009 - 3:44 AM

Here are the answers to your questions:

1) No. Prof-UIS does not have such functions. But MFC allows you to compute the rest inner space of the main frame window which is free of any control bars.

1a) The inner part of the main frame window is occupied by the window with the AFX_IDW_PANE_FIRST dialog control identifier. This is the view window in SDI frames. This is the dark gray MDI client area window in MDI frames. You can get rectangle of this window.

CRect rc;
pMainFrame->GetDlgItem( AFX_IDW_PANE_FIRST )->GetWindowRect( &rc );
pMainFrame->ScreenToClient( &rc );


1b) You can ask the main frame to compute the required inner space which is free of any control bars.
CRect rc;
pMainFrame->GetClientRect( &rc );
pMainFrame->RepositionBars( 0, 0xFFFF, AFX_IDW_PANE_FIRST, CWnd::reposQuery, &rc, &rc );

In both cases, the rc contains required rectangle. The second case works even if the window with the AFX_IDW_PANE_FIRST dialog control identifier is not created yet inside the main frame window.

2) The main frame window recomputes layout of all its child control bar windows and view window in the center automatically. You never need to compute this layout manually. You can create and use your own CExtControlBar-derived class which implements the CExtControlBar::OnControlBarPositionChange() virtual method for catching all the possible position changing events for each of control bars. You can also override this virtual method in your CExtDynamicControlBar-derived, CExtToolControlBar-derived, CExtMenuControlBar-derived and CExtPanelControlBar-derived classes if needed.