Wiki Home

Tab Strip

Namespace: WIN_COM_API
The Microsoft Tab Strip Control is part of the Microsoft Common Controls (MSCom Ctl or Com CTRL 32) it is used to provide a tabbed dialog (Page Frame). You can use this control to create tabs along the left, bottom or right of the Page Frame. Using the actual Page area of this control in VFP is impractical, but that doesn't mean the control can't be used at all. I find it ideal to use the Tab Strip along with a Tabless VFP Page Frame (set Tabs = .f.). Size the Tab Strip so that only the tabs are visible, place them right next to the Page Frame. The Click method of the Tab Strip hooks it to the Page Frame see the appropriate code below.

The Tab Strip control also can be attached to an Image List to provide icons on the tabs. You need to do this at runtime and assign the tab images with code like this:
with this.oTabStrip
   .ImageList = this.oImageList
   .Tabs(1).Image = "AnImageName"
   .Tabs(2).Image = "AnotherImageName"
   .Tabs(3).Image = 3 && can use numeric index too

If you set the TabWidthStyle = 2 - tabFixed you get a compact version of tabs that adds a scroll control to let you choose tabs that are not visible if the control is not sized large enough to display all of the tabs at once. Several dialogs in Visual C++ use this format.

For the version of the control that shipped with VFP6 (OLEClass = MSComctl Lib.TabStrip.2) or the version of the control that shipped with VFP5 (OLEClass = COMCTL.TabStrip.1) use this Click method:
*** ActiveX Control Event ***

this.parent.pgfMain.ActivePage = this.object.SelectedItem.Index

Note: for OLEClass = COMCTL.TabStrip.1 the tabs will only display on the top, but it does support TabWidthStyle = tabFixed.

For the Sheridan version of the control that shipped with VFP5 (or maybe it was VFP3?)(OLEClass=TabDlg.SSTab.1) use this Click method:
*** OLE Control Event ***
LPARAMETERS previoustab

* The TabStrip uses a 0 based index, thus we need the + 1.
this.parent.pgfMain.ActivePage = this.object.Tab + 1

Contributors df
Category ActiveXControls Category Code Samples
( Topic last updated: 2000.11.01 10:56:51 PM )