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 » ExtTabWnd, _SyncAllItems: changes to avoid Assertion failure. Collapse All
Subject Author Date
marc uchida Oct 16, 2007 - 12:33 PM

The first bit of info on my problem is that it only occurred after I updated to profuis 280 from 262.
My app was working fine in 262.

I have a class whose base class is CExtTabMdiOneNoteWnd. It was created so that we could do something out of the ordinary with the tab mdi windows. We want to make certain tabs hide-able in some situations. This now leads to
an Assertion failure in CExtTabWnd::AssertValid(), because m_nVisibleItemCount end up greater than nItemCount.
In release build, the result is flashing windows, because they are being inserted and removed continuously.
_SyncAllItems keeps trying to snyc the item and visibility counters, but it never can.

To solve the problem for now, we made a virtual function for _SyncAllItems so we could apply a change here in the logic.
The change as follow....

        ModifyTabWndStyle(
            bCloseEnabled ? 0 : __ETWS_ENABLED_BTN_CLOSE,
            bCloseEnabled ? __ETWS_ENABLED_BTN_CLOSE : 0,
            false
            );
        INT nVisibleCount = 0;
        for( ; hWndMdiChild != NULL; hWndMdiChild = ::GetWindow( hWndMdiChild, GW_HWNDNEXT ) )
        {
// original code here: checking for visibility before checking for the handle !?
//            if( ( ::GetWindowLong( hWndMdiChild, GWL_STYLE ) & WS_VISIBLE ) != 0 )
//                nVisibleCount ++;
///////////////////////////////////////////////////////////////////////////////////////

            LONG nIndexExist = ItemFindByHWND( hWndMdiChild, -1, true, true );
            if( nIndexExist >= 0 )
            {
// our solution to the flashing window problem... move above code down here.
                if( ( ::GetWindowLong( hWndMdiChild, GWL_STYLE ) & WS_VISIBLE ) != 0 )
                    nVisibleCount ++;
////////////////////////////////////////////////////////////////////////////////////////

                if( hWndMdiChild == pWndActiveMdiChild->GetSafeHwnd() )
                    SelectionSet( nIndexExist, true, false );
                continue;
            }
            ItemInsert(
                NULL,
                NULL, false,
                0,
                -1,
                LPARAM( hWndMdiChild ),
                false
                );



My question to you then has several angles. ..
1. is this code change going to lead to other problems? It seems to work ok now.
2. is this change better in general? I ask because it seem funny to check for visibility before checking for the handle existence, rather than the other way around, as our changes do. If you are checking for the visibility of a window it must have a handle, no?
3. is there a better way around this problem?

any insight would be appreciated, thanks.

p.s. not looking forward to comparing our version of_SyncAllItems with yours every time we get an upgrade from you... the problems with overriding profuis functions. ;P