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 » Flickering in CExtTabPageContainerWnd Collapse All
Subject Author Date
Raffaele Cappelli May 23, 2006 - 4:08 PM

I am experiencing flickering when switching tabs. This happens when the child window corresponding to new selected tab was smaller and has to be resized.

If in function CExtTWPC<_BT>::OnTabWndSelectionChange(...) I move
GetParent()->CWnd::RepositionBars( 0, 0xFFFF, 0x101 + nNewItemIndex )
before
::ShowWindow( hWndNew, SW_SHOW );
then the problem seems to be solved.
Do you think there is any side effect of this fix?

Technical Support May 24, 2006 - 1:01 PM

We agree the painting code for the tab area should be improved in the Native XP theme. We have two improved methods related to the tab page containers: CExtTWPC::OnTabWndSelectionChange() and CExtTabPageContainerWnd::_RepositionBarsImpl(). Here is the source code:

    virtual bool OnTabWndSelectionChange(

        LONG nOldItemIndex,

        LONG nNewItemIndex,

        bool bPreSelectionTest

        )

    {

        if( ! _BT::OnTabWndSelectionChange(

                nOldItemIndex,

                nNewItemIndex,

                bPreSelectionTest

                )

            )

            return false;

        if( (! bPreSelectionTest ) && nNewItemIndex >= 0 && _BT::ItemGetCount() > 0 )

        {

            GetParent() -> CWnd::RepositionBars( 0, 0xFFFF, 0x101 + nNewItemIndex );

            HWND hWndNew = NULL;

            if( nOldItemIndex >= 0 )

            {

                hWndNew = (HWND) _BT::ItemLParamGet( nNewItemIndex );

                if( hWndNew != NULL && ::IsWindow( hWndNew ) )

                    ::ShowWindow( hWndNew, SW_SHOW );

                else

                    hWndNew = NULL;

            }

            if( nOldItemIndex >= 0 )

            {

                HWND hWndOld = (HWND) _BT :: ItemLParamGet( nOldItemIndex );

                if( hWndOld != NULL && ::IsWindow( hWndOld ) )

                    ::ShowWindow( hWndOld, SW_HIDE );

            }

            HWND hWndFocus = ::GetFocus();

            if( hWndFocus != NULL && hWndNew != NULL )

                ::SetFocus( hWndNew );

        }

        return

            ((CExtTabPageContainerWnd*)GetParent())->OnTabWndSelectionChange(

                nOldItemIndex,

                nNewItemIndex,

                bPreSelectionTest

                );

    }

 

    void CExtTabPageContainerWnd::_RepositionBarsImpl()

    {

        int nPos = 0, nAdjustPos = -1;

        if( m_pWndTab->GetSafeHwnd() != NULL )

        {

            nPos = (int)m_pWndTab->SelectionGet();

            if( nPos < 0 )

                nPos = 0;

            else

                nAdjustPos = nPos;

        }

        CWnd::RepositionBars( 0, 0xFFFF, 0x101 + nPos );

        if( nAdjustPos >= 0 )

        {

            HWND hWnd = (HWND) m_pWndTab->ItemLParamGet( nAdjustPos );

            if(        hWnd != NULL

                &&    ::IsWindow( hWnd )

                &&    ( ::GetWindowLong( hWnd, GWL_STYLE ) & WS_VISIBLE ) == 0

                )

                ::ShowWindow( hWnd, SW_SHOW );

        }

    }


Raffaele Cappelli May 25, 2006 - 2:37 AM

Actually I noted the flickering in the Office 2007 Obsidian theme (since with the black background it was more evident).

In any case, I confirm that in the last version it is solved.