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 » MDI tabs Collapse All
Subject Author Date
Robert Webb Mar 15, 2010 - 8:59 PM

Hi,


Is it possible to set things up so that the MDI tabs only appear when there’s more than one document?  Would be great if there was a style for this somewhere.


Thanks,


Rob.

Technical Support Mar 22, 2010 - 11:35 AM

We think with this version the problem should be gone:

void C_YOUR_MdiTabWnd::OnTabWndSyncVisibility()
{
            ASSERT_VALID( this );
            if( GetSafeHwnd() == NULL )
                        return;
bool bZeroItemCount = ( ItemGetCount() == 0 ) ? true : false;
            if( ( GetStyle() & WS_VISBIBLE ) != 0 )
            {
                        if( ! bZeroItemCount )
                                    return;
            }
            else
            {
                        if( bZeroItemCount )
                                    return;
            }
        ShowWindow( ( ! bZeroItemCount ) ? SW_SHOW : SW_HIDE );
}



Technical Support Mar 17, 2010 - 2:29 AM

You can do that by overriding CExtTabWnd::OnTabWndSyncVisibility() in the following way:

void C_YOUR_MdiTabWnd::OnTabWndSyncVisibility()
{
            ASSERT_VALID( this );
            if( GetSafeHwnd() == NULL )
                        return;
        ShowWindow( ( ItemGetCount() > 0 ) ? SW_SHOW : SW_HIDE );
}




Robert Webb Mar 21, 2010 - 8:26 PM

Thanks, it works!


We found that it’s best to return without doing anything though if ItemGetCount() returns zero. If you call ShowWindow with SW_SHOW otherwise (we give the user the option to always show or hide when only one tab) then it leads to endless repaint messages being sent.  Don’t know why, but that test avoids it.


Thanks, this one’s solved.


Rob.