Page, PageFrame
Multi-page tabbed dialogs were one of the hottest things around when VFP was introduced. Now it seems they're everywhere. Visual FoxPro's version is called a PageFrame. It's a container object that contains Pages. Pages are also containers and can contain any controls, even other PageFrames.We do think page frames are pretty cool looking. We also think they're terribly overused. Like so many of the other widgets in Windows, page frames are useful in dialogs. The Tools-Options dialog is the prime example of this, but many builders also make good use of page frames (and those guys are all built in Visual FoxPro). However, you can go too far with this. A page frame is heavily mouse-oriented—it has no place in heads-down data entry. (Neither do a lot of the other fancy controls, but that's not what we're talking about here.)Use page frames where they make the resulting form clearer. The builders are a good example of this—while everything in the builder is related, each page contains a set of items that are closely related to each other.Although tabbed interfaces are all the rage, you can also make tabless page frames. We can imagine using them for some of the things we used to do with multi-screen sets where all the screens occupied the same location.PageFrame
Property |
Value |
Purpose |
Numeric |
The number of the page currently on top. This number is based on PageOrder, not creation order. |
|
Collection |
A COM collection containing references to the individual pages in the page frame. Also, has a Count property. |
|
Numeric |
The number of pages in the page frame. |
|
Numeric |
The size of an individual page. |
|
Collection |
References to the individual pages in the page frame. |
|
Logical |
Determines whether the individual pages have tabs at the top. |
|
Numeric |
Determines whether multiple rows of tabs are used when the tabs don't fit in a single row. |
|
Numeric |
Determines whether all tabs are the same width or each is sized to accommodate its Caption. |
Event |
Purpose |
Fires when the page frame's position is changed programmatically. |
Page
Property |
Value |
Purpose |
Object |
Reference to the control on the page that has focus. |
|
Character |
The text on the page's tab. Can include a hotkey. |
|
Numeric |
The number of controls on the page. |
|
Collection |
References to the individual controls on the page. |
|
Collection |
A COM collection containing references to the controls on the page. Also has a Count property. |
|
Numeric |
The display position of this page in the page frame. |
The documentation for VFP 5 and later says that Page has the KeyPreview property. (Page is listed in the Applies To list of the KeyPreview topic.) They did in VFP 3 (though it didn't do anything there). It was removed in VFP 5. |
Early versions of VFP had some problems dealing with changes to a page's Name after you've started messing with it. All the code to set page properties is stored in the Properties memo of the page frame that contains it. In earlier versions, when you set some properties for the page, and then changed the page's name, some of the property assignments used the original default name (Page1 or whatever) while some used the new name. |
Example |
* All the changes shown here would be made * in the Property Sheet. * Set a PageFrame to have 3 pages. * With the PageFrame selected: PageCount = 3 * Set a page to have white on blue text * and to have a tab of "Sky". * With the page selected: BackColor = RGB(0,0,255) ForeColor = RGB(255,255,255) Caption = "Sky" |
See Also |
ActiveControl, ActivePage, Caption, ControlCount, Controls, KeyPreview, MouseEnter, MouseLeave, Moved, Objects, PageCount, PageHeight, PageOrder, Pages, PageWidth, Tabs, TabStretch, TabStyle, UIEnable |