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 » Changing MDI tab label forced redraw of view Collapse All
Subject Author Date
Robert Webb Apr 13, 2010 - 2:34 AM

Hi,


I emailed you recently with some sample code demonstrating that clicking on an MDI tab forces a repaint of all views, even if only one needs redrawing, or even if you click on the tab that’s already current, or even if you click on the X to close a tab (it first redraws everything).


I have now noticed a similar problem.  When the document title has changed, which in turn changes the MDI tab label, again ALL the views are redrawn although none need it.


The code I’m using to update the MDI tabs when the doc title changes is as follows:



void CMyDocument::SetTitle(LPCTSTR lpszTitle)
{
    if (CDocument::GetTitle() != lpszTitle)
    {
        CDocument::SetTitle(lpszTitle);
        CMDITabs &mdiTabs = ptheWinApp->GetMainFrame()->m_MDITabs;
        if (mdiTabs.ItemGetVisibleCount() > 0)
            mdiTabs.UpdateTabWnd();
    }
}

Without the three lines starting at "CMDITabs &mdiTabs..." the redraw does not occur, but the MDI tab label also doesn’t update.  CMDITabs is derived from CExtTabMdiWnd.  We need to avoid these unnecessary redraws.  Maybe it’s the same problem as the one I emailed you?


Thanks,


Rob.

Technical Support Apr 13, 2010 - 10:30 AM

We replied to your e-mail. The problem is that the tab window performs main frame’s layout recalculation. We need to analyze when it’s possible to avoid this.

Robert Webb Apr 13, 2010 - 7:17 PM

Thanks, I’ve replied by email too.  My main thought is that I can’t think when there would EVER be a need to recalc the layout when doing one of the following things:


- Clicking on the current MDI tab


- Clicking on a different MDI tab


- Clicking on a tab’s X to close it


- Programmatically changing the document title and calling UpdateTabWnd() to reflect the changes in the MDI tab


 


None of these things, as far as I can tell, will ever affect the layout outside the MDI tabs window itself.


Thanks,


Rob.