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 » MFC Page Navigation Control's panes height Collapse All
Subject Author Date
Sergio Buonanno Aug 6, 2008 - 2:38 AM

I have an application with MS Outlook look and feel. The page navigation control on the left is divided in two panes: a standard pane and a Favorites pane. The Favorites pane is located at the top of the navigation control as in Outlook and its height is calculated in the following way:

The height must be enough to show all the tree items inside the control but it cannot be higher than half of the entire navigation control client area that is occupied by the Favorites and Main tree controls (each inside a pane), because the Standard Tree (that looks like the Main Folders in Outlook) has higher priority and it must occupied an area that at least is half the height of the page navigation control client area, and it can never be shorter than the Favorites tree control. The behavior of my application is slightly different from that of Outlook, where the Favorites pane has higher priority and its height could be higher than that of the Main Folders’. In my case is exactly the opposite, even if the UI of the page navigation control is exactly like Outlook’s.

I succeed to manage this situation when the page navigation control is docked to the application main window using the methods:


CExtPageNavigatorWnd::ITEM_PANE_INFO->HeightSet(hFavPane);

CExtPageNavigatorWnd::ITEM_PANE_INFO->HeightSet(hMainPane);


(In other words: hFavPane cannot be greater than hMainPane and in any case it must be <= of half the page navigation control client area’s height)


But that doesn’t work when the navigation pane is floating. May you please suggest me a better way to calculate and set panes height at run-time so that I can have full control in settings panes’ height especially when the page navigation control is floating and not docked ?


 

Sergio Buonanno Aug 13, 2008 - 6:53 AM

I’m sorry, I had a problem with the Paste command....my code is:


 


CExtPageNavigatorWnd::PAGE_ITEM_INFO *pPage = m_pParentNav->ItemGetInfo(m_iPage /*idxPage*/); 



CExtPageNavigatorWnd::ITEM_PANE_INFO *pPane1 = pPage->PaneGetInfo(INDEX_PANE_FAVORITES);



CExtPageNavigatorWnd::ITEM_PANE_INFO *pPane2 = pPage->PaneGetInfo(INDEX_PANE_NAVIGATION);


 


CRect rcPage;



m_pParentNav->GetClientRect(rcPage);



int iMinH = (rcPage.Height() / 2) - 10;



long lHalfH = iMinH / 2;


 


The value of lHalfH is the problem, because m_pParentNav->GetClientRect(rcPage) fails to return the correct value when the pane is floating. I need to calculate the value of half the height of the Page Navigation control’s client area and that doesn’t work correctly when the Page Navigation control is floating.

Technical Support Aug 14, 2008 - 2:21 PM

GetClientRect may return a zero rectangle if the control bar where you created your page navigator is not yet shown on the screen. Try to move your code after the control bar become visible. For example after CExtControlBar::ProfileBarStateLoad method invocation if you use control bar persistence.

Technical Support Aug 9, 2008 - 12:12 PM

The current page navigator implementation allows you to set one pane with its height automatically calculated . If you specify the item height equal to -1, then this item will always have the height that is equal to the free space left after resizing other panes. Notice that only one pane can have the height equal to -1. In your case, you can set -1 for the first favorites pane and some particular height for the second main pane. If this solution is not that you are looking for, please let us know.

Sergio Buonanno Aug 11, 2008 - 1:02 AM

That is what I do, but unfortunately it doesn’t work when the Page Navigator control is floating. In that case it looks like the method HeightSet changes behavior and it doesn’t work correctly. In my function a make the following calls:



pPane1->HeightSet(lNewFavoritesH);

pPane2->HeightSet(-1);



lNewFavoritesH value depends on the number of tree items in the Favorites pane. Everything is ok with a docked Page Navigator control; it stops working when the Page Navigator is floating, I mean, the Favorites pane (Pane 1) is reduced to almost zero height.

Take into account that the Page Navigator control’s panes height is set during application start-up in the OnCreate event handler of the main window.