Disable Tab

This class provides enabling and disabling of items in a
tab control. The main
purpose of the class is to provide this functionality for property
sheets, but I think it may
work for tab controls in general (I have not tested this).

Anyway, to use the class, just include the source and header file into
your project. Create
a member variable of type CTabCtrlEx in your property sheet derived
class. Then, in the
OnInitDialog function of your property sheet class call the CTabCtrlEx
install function:

BOOL CMyPropertySheet::OnInitDialog()
{
    BOOL bResult = CPropertySheet::OnInitDialog();

    // TODO: Add your specialized code here
    ...
    m_tab.Install( this );
}

To enable or disable items, call the EnableItem() function:

    m_tab.EnableItem( 0, FALSE );

I have not had time to thoroughly test this class, but the code is
fairly well commented, so
following it should not be very difficult if you have problems. Please
send me any comments,
feedback bug fixes, etc. Enjoy!

Download source files 7KB

More by Author

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Must Read