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 » MDI Tab fails after moving from Prof-UIS ver. 2.52 to ver. 2.61 Collapse All
Subject Author Date
Sergio Buonanno Nov 27, 2006 - 10:37 AM

My MDI application doesn’t work anymore with Prof-UIS 2.61 after moving from 2.52. The function:

void CExtTabWnd::AssertValid() const
{
    CWnd::AssertValid();
__EXT_MFC_INT_PTR nItemCount = m_arrItems.GetSize();
    ASSERT(
            m_nVisibleItemCount >= 0
        &&    m_nVisibleItemCount <= nItemCount
        );
}

throws an assert because m_nVisibleItemCount == -1

David Heitbrink Jan 17, 2007 - 2:03 PM

I was having the same problem (I moved from 2.52? to 2.62), after inserting the code posted here and rebuilding it seemed to have fixed the problem, is there any chance this will be part of future builds?, or is there now a better way around this problem?

Technical Support Nov 28, 2006 - 9:20 AM

There is not enough information in your message so we can help you. Would you tell us how we can reproduce this problem using one of our samples?

Sergio Buonanno Nov 28, 2006 - 9:24 AM

I cannot reproduce this problem with a sample application of yours. The MDI Tab behavior has been modified by your tech-support during a Net Meeting session in which you modified directly our application’s source code.

Sergio Buonanno Nov 28, 2006 - 12:20 PM

I think the behavior has changed because just rebuilding the application with Prof-UIS ver. 2.54 is enough to fix the problem. I guess your samples are ok because you already tested them, it will take some time to me to find out what causes Prof-UIS failure. I’ll try to debug and give you more info.

Sergio Buonanno Nov 29, 2006 - 2:06 AM

I found the problem. If you hide the opening MDI child before the MDI Tab is updated (just after the MDI child window is created), Prof-UIS throws the assert. Older versions hadn’t the same bahavior.

Technical Support Nov 30, 2006 - 1:13 PM

Please try the following. Open the CExtTabWnd::TAB_ITEM_INFO::ModifyItemStyle() method and find these lines:

if( bNowVisible )
    m_pWndTab->m_nVisibleItemCount ++;
else
    m_pWndTab->m_nVisibleItemCount --;
Replace the above code with this:
if( bNowVisible )
{
    if( m_pWndTab->m_nVisibleItemCount < m_pWndTab->m_arrItems.GetSize() )
        m_pWndTab->m_nVisibleItemCount ++;
}
else
{
    if( m_pWndTab->m_nVisibleItemCount > 0 )
        m_pWndTab->m_nVisibleItemCount --;
}
Update the OnTabWndSyncVisibility() method in the CExtTMWI template. This should make the tab strip hidden when the number of visible tabs gets equal to zero.
virtual void OnTabWndSyncVisibility()
{
    LONG nItemCount = ItemGetCount();
    LONG nItemVisibleCount = ItemGetVisibleCount();
    DWORD dwWndStyle = GetStyle();
    if(        nItemCount > 0 
        &&    nItemVisibleCount > 0
        &&    (!(        CExtControlBar::FindPrintPreviewMode(
                        STATIC_DOWNCAST( CFrameWnd, GetParent() )
                        )
                ||    CExtControlBar::IsOleIpObjActive(
                        STATIC_DOWNCAST( CFrameWnd, GetParent() )
                        )
            ) )
        )
    {
        if( (dwWndStyle & WS_VISIBLE) == 0 )
        {
            ::SetWindowPos(
                m_hWnd,
                NULL, 0, 0, 0, 0,
                SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_NOOWNERZORDER
                    |SWP_FRAMECHANGED
                    |SWP_SHOWWINDOW
                );
            HWND hWndMdiArea = _GetHwndMdiArea();
            if( hWndMdiArea != NULL )
                ::SetWindowPos(
                    hWndMdiArea,
                    NULL, 0, 0, 0, 0,
                    SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_NOOWNERZORDER
                        |SWP_FRAMECHANGED
                    );
        }
    } // if( nItemCount > 0 ...
    else
    {
        if( (dwWndStyle & WS_VISIBLE) != 0 )
            ::SetWindowPos(
                m_hWnd,
                NULL, 0, 0, 0, 0,
                SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_NOOWNERZORDER
                    |SWP_NOSENDCHANGING
                    |SWP_HIDEWINDOW
                );
    } // else from if( nItemCount > 0 ...
    dwWndStyle = GetStyle();
    if( (dwWndStyle & WS_VISIBLE) == 0 )
        m_nIndexVisFirst = m_nIndexVisLast = -1;
}