Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

TabStretch, TabStyle

These page frame properties determine whether the pages are kept in a single row or stacked in multiple rows (like the Tools-Options dialog) if the captions don’t all fit in a single row, and whether all the tabs are the same size or if they adjust to fit their captions.

Usage

pgfPageFrame.TabStretch = nStackOrClip
nStackOrClip = pgfPageFrame.TabStretch
pgfPageFrame.TabStyle = nFixedOrNot
nFixedOrNot = pgfPageFrame.TabStyle

We guess Microsoft figures there might be some other choices for these properties someday. It’s the only reason we can think of for making them numeric instead of logical. Visual SourceSafe shows one such possibility—a “ragged row” of tabs, with forward/back buttons to scroll through the tabs, looking sort of like a spinner on its side. It does free up some screen real estate, but it doesn’t do much for us.

VFP 5 and later versions are smarter than VFP 3 in deciding what constitutes the tabs fitting. We suspect that’s due to the addition of TabStyle, which no doubt necessitated some work in the calculation of tab sizes. In VFP 3, there’s no way to control the size of the tabs, so it’s not like FoxPro says, “I can only fit this many of your desired tab width in the allocated space.” We’ve seen tabs get stacked in that version even when there appeared to be plenty of white space on either side of every tab caption. In these cases, we can set TabStretch to “clip” and still see the complete caption for every tab. Fortunately, later versions of VFP seem to do a much better job of this.

When you do stack tabs, be sure to leave TabStyle at the default, 0-Justified. (For a good laugh, create a page frame with a whole bunch of pages with different caption widths, then set TabStretch to 0-Multiple Rows and TabStyle to 1-Nonjustified.) In VFP 3, you’ll want to fiddle with the page frame’s size to be sure every row has the same number of pages. The look of a page frame with an odd number in the last row is really strange.

Example

ThisForm.pgfQuarters.TabStretch = 0  && but you'll usually set
ThisForm.pgfQuarters.TabStyle = 0    && these in the PropSheet

See Also

Page, PageCount, PageFrame, Tabs