TPages
Fonte: source/classes/tpages.prg
Inherits from: TControl, uses TPagesDialog
TPages is a tab-page container control that manages a collection of dialog pages within a single parent window area. Each page is a dialog hosted inside the container, and the user switches between pages programmatically or via associated tab controls. Internally it works with TPagesDialog to render each page surface.
Key DATA Members
| DATA | Type | Description |
|---|---|---|
nOption | Numeric | Index of the currently selected page (1-based) |
aDialogs | Array | Array of child dialog objects, one per page |
aPages | Array | Array of page definition arrays { cTitle, nId, bInit } |
bChange | Block | Code block executed when the active page changes |
Methods
| Method | Description |
|---|---|
New( nRow, nCol, nBottom, nRight, oWnd ) | Create a new TPages container within a window |
Redefine( nId, oWnd, aDialogs, nOption, bChange ) | Recreate from a dialog resource control |
AddPage( cPage ) | Add a new page with the given title |
DelPage( nPage ) | Remove the page at the specified index |
SetOption( n ) | Switch to the page at index n |
GoPrev() | Switch to the previous page |
GoNext() | Switch to the next page |
Example: Two-Page Container
#include "FiveWin.ch"
function Main()
local oWnd, oPages
DEFINE WINDOW oWnd TITLE "TPages Demo" SIZE 500, 400
@ 10, 10 PAGES oPages SIZE 460, 340 OF oWnd
oPages:AddPage( "General" )
oPages:AddPage( "Advanced" )
@ 20, 20 SAY "User Name" OF oPages:aDialogs[ 1 ] SIZE 60, 12
@ 20, 100 GET ... OF oPages:aDialogs[ 1 ]
@ 20, 20 SAY "Timeout" OF oPages:aDialogs[ 2 ] SIZE 60, 12
@ 20, 100 GET ... OF oPages:aDialogs[ 2 ]
ACTIVATE WINDOW oWnd CENTERED
return nil
Notes
- Each page is implemented as a modeless child dialog. Access child controls through the corresponding dialog object in
aDialogs. - Use
bChangeto perform validation or update UI state when the user switches pages. TPagesDialogis the internal dialog class used for each page surface; it is not typically instantiated directly.- The container fires the
bChangecode block with the new option index each time the page is switched.