EnableStackedTabs()
Marvin Hymowech -- Marvin_Hymowech@msn.com
Sunday, July 14, 1996
Hi all,
Environment: Win95, VC++ 4.1
I would like to display a property sheet with scrolling tabs across the top.
I tried calling EnableStackedTabs(FALSE) in OnCreate of a class derived from
CPropertySheet, as follows:
int CMyPropertySheet::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
EnableStackedTabs(FALSE);
if (CPropertySheet::OnCreate(lpCreateStruct) == -1)
return -1;
return 0;
}
This does indeed produce scrolling tabs, but with a curious side-effect: If I
add sufficiently
many property pages so that stacking or scrolling is actually necessary, the
controls
in each of my property pages are displaced downwards by an amount which seems
to
be equal to the height of the additional tab rows which would have appeared if
the
default stacked tabs style were used (adding more rows displaces the controls
further).
This unwanted displacement occurs for both modal and modeless property sheets.
(Perhaps the layout logic for CPropertySheet is ignoring the fact that the tab
control
is using scrolling tabs?)
Does anyone know of a workaround for this?
Thanks,
- Marvin Hymowech
Dean McCrory -- deanm@microsoft.com
Tuesday, July 16, 1996
[Mini-digest: 3 responses]
I believe you are running into a known Win95 bug.
// Dean
>----------
>From: Marvin Hymowech[SMTP:Marvin_Hymowech@msn.com]
>Sent: Sunday, July 14, 1996 10:35 AM
>To: mfc-l@netcom.com
>Subject: EnableStackedTabs()
>
>Hi all,
>
>Environment: Win95, VC++ 4.1
>
>I would like to display a property sheet with scrolling tabs across the top.
>I tried calling EnableStackedTabs(FALSE) in OnCreate of a class derived from
>CPropertySheet, as follows:
>
>int CMyPropertySheet::OnCreate(LPCREATESTRUCT lpCreateStruct)
>{
> EnableStackedTabs(FALSE);
> if (CPropertySheet::OnCreate(lpCreateStruct) == -1)
> return -1;
> return 0;
>}
>
>This does indeed produce scrolling tabs, but with a curious side-effect: If
>I
>add sufficiently
>many property pages so that stacking or scrolling is actually necessary, the
>controls
>in each of my property pages are displaced downwards by an amount which seems
>to
>be equal to the height of the additional tab rows which would have appeared
>if
>the
>default stacked tabs style were used (adding more rows displaces the
>controls
>further).
>This unwanted displacement occurs for both modal and modeless property
>sheets.
>(Perhaps the layout logic for CPropertySheet is ignoring the fact that the
>tab
>control
>is using scrolling tabs?)
>
>Does anyone know of a workaround for this?
>
>Thanks,
>
>- Marvin Hymowech
>
-----From: Brian_Dormer@ftdetrck-ccmail.army.mil
Try moving the EnableStackedTabs() to ***AFTER*** the OnCreate()
If you read the docs carefully - I think it says that you have to call
OnCreate **FIRST**, then do whatever else you want.
bd
-----From: "Robertson David"
You are very close! MFC has a problem. It will do scrolling tabs, but
only after allocating window client space for all tabs for all pages.
The way to get around this is to only add 1 page, then, after creation
of the property sheet, add the remainder of the pages.
Here's what to do:
1. Put a CPtrList member object in your CPropertySheet object.
2. After creation of your sheet and pages, add ONLY the 1st page.
3. Add pointers to all other pages to the CPtrList member.
4. In your sheet's OnInitDialog:
A. Call EnableStackedTabs(FALSE).
B. Call the base class OnInitDialog.
C. Iterate the CPtrList member, adding rest of the pages.
| Вернуться в корень Архива
|