PRB: Stacked Tabs Aren't Displayed Correctly After AddPage() (142446)



The information in this article applies to:

  • The Microsoft Foundation Classes (MFC), when used with:
    • Microsoft Visual C++, 32-bit Professional Edition 4.0
    • Microsoft Visual C++, 32-bit Learning Edition 4.0

This article was previously published under Q142446

SYMPTOMS

When CPropertySheet::AddPage() is called and a tab is too wide to fit in the existing row of tabs, the CPropertySheet will create a new row with the new tab. This can cause the bottom row of tabs to disappear.

NOTE: This will only occur when calling CPropertySheet::AddPage() after calling CPropertySheet::Create or CPropertySheet::DoModal().

CAUSE

The CPropertyPage and CPropertySheet are not resized when AddPage() is called. As a result, the active CPropertyPage could cover a row of tabs and obscure it from view.

RESOLUTION

You can do either of the following:

  • Call CPropertySheet::EnableStackedTabs(FALSE) before the call to DoModal() or Create(). This will disable stacked tabs. When there isn't enough space to add a tab and AddPage() is called, a scrollbar will appear which allows you to scroll to the desired tab. -or-

  • Call AddPage() for all possible pages. This will create a CPropertySheet with CProppertyPage items whose size will allow for the additional rows of tabs. If you don't want to display all of the pages initially, derive a class from CPropertySheet, override CPropertySheet::OnInitDialog(), and remove unwanted tabs by calling RemovePage().

Modification Type:MajorLast Reviewed:11/18/2003
Keywords:kbprb kbPropSheet kbTabCtrl KbUIDesign KB142446