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 » Bug In CExtTabPageContainerWnd Collapse All
Subject Author Date
Offer Har Aug 8, 2006 - 11:41 AM

Hi,

I have a tab container with several tabs. I use the PageVisibleSet function to show/hide tabs according to user’s selection. When the user select nothing, i would to hide all the Tabs.
When this is done, the tab control shows not tab, but the dialog of the first tab is displayed.Nothing is to be displayed in the tabs dialogs area when no tabs are visible.

Thanks in advance,

Offer

Technical Support Aug 9, 2006 - 9:03 AM

We are not sure this is a bug. The CExtTabPageContainerWnd window simply "assumes" the selected page cannot be invisible. So, if you want to hide some tab page, just check whether its index is equal to the selected page index returned by CExtTabPageContainerWnd::PageSelectionGet(). You should reset the selection to some other visible tab page or unset selection at all using the -1 value as a parameter of the CExtTabPageContainerWnd::PageSelectionSet() method.

Offer Har Aug 9, 2006 - 9:07 AM

Hi,

I tried to call PageSelectionSet(-1), but it asserts in this line:

ProfUIS254md.dll!CExtTabWnd::ItemGet(long nIndex=-1) Line 1085 + 0x17    C++ :
CExtTabWnd::TAB_ITEM_INFO * CExtTabWnd::ItemGet( LONG nIndex )
{
    ASSERT_VALID( this );
    LONG nCount = ItemGetCount();
    if( nIndex < 0 || nIndex >= nCount )
    {
        ASSERT( FALSE ); <--- HERE!
        return NULL;
    }
    TAB_ITEM_INFO * pTii = m_arrItems[ nIndex ];
    ASSERT_VALID( pTii );
    ASSERT( pTii->m_pWndTab == this );
    return pTii;
}

So, this is impossible. Please supply me another solution...

Thanks,

Offer.

Technical Support Aug 9, 2006 - 10:22 AM

You can use the following code to clear the selection:

CExtTabPageContainerWnd * pWndTPC = . . .
CExtTabWnd * pWndTab = pWndTPC->GetSafeTabWindow();
    pWndTab->SelectionSet( -1 );

Offer Har Aug 9, 2006 - 10:27 AM

No.

As i said before, this crashes on assert:

CExtTabWnd::TAB_ITEM_INFO * CExtTabWnd::ItemGet( LONG nIndex )
{
    ASSERT_VALID( this );
    LONG nCount = ItemGetCount();
    if( nIndex < 0 || nIndex >= nCount )
    {
        ASSERT( FALSE ); <---- HERE IT CRASH!!
        return NULL;
    }
    TAB_ITEM_INFO * pTii = m_arrItems[ nIndex ];
    ASSERT_VALID( pTii );
    ASSERT( pTii->m_pWndTab == this );
    return pTii;
}

Technical Support Aug 10, 2006 - 6:39 AM

We confirm this problem. We have used the following test project for debugging: http://www.prof-uis.com/download/forums/HidePagesInTPC.zip. The problem can be fixed by updating the following method:

bool CExtTabPageContainerWnd::OnTabWndSelectionChange(
    LONG nOldItemIndex,
    LONG nNewItemIndex,
    bool bPreSelectionTest
    )
{
    ASSERT_VALID( this );
    nOldItemIndex;
    if( ! bPreSelectionTest )
    {
        _RealignAllImpl();
        RemoveAllWndHooks();
        if( nNewItemIndex >= 0 )
        {
            HWND hWndNew = (HWND)m_pWndTab->ItemLParamGet(nNewItemIndex);
            SetupHookWndSinkToChilds(
                hWndNew,
                NULL,
                0,
                true
                );
        }
    }
    return true;
}

Offer Har Aug 10, 2006 - 2:06 PM

Thanks,

That solved the problem.