TPages

Fuente: 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

DATATypeDescription
nOptionNumericIndex of the currently selected page (1-based)
aDialogsArrayArray of child dialog objects, one per page
aPagesArrayArray of page definition arrays { cTitle, nId, bInit }
bChangeBlockCode block executed when the active page changes

Methods

MethodDescription
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

Ver También