TPager

Source: source/classes/tpager.prg

Inherits from: TControl

TPager is a wrapper for the Win32 SysPager common control. It provides scroll buttons (arrows) that allow the user to navigate through a child window that is larger than the visible area. Typically used with toolbar controls or other wide child windows that need horizontal or vertical scrolling without standard scrollbars.

Key DATA Members

DATATypeDescription
oChildObjectThe child window/control contained within the pager
lHorzLogicalHorizontal orientation (default .F. = vertical)
lAutoScrollLogicalEnable auto-scrolling when mouse hovers near edge
lDragDropLogicalEnable drag-and-drop scrolling
nBtnSizeNumericSize of the scroll arrow buttons (default 12)
nBkColorNumericBackground color (default COLOR_BTNFACE)
nBorderNumericBorder width in pixels (default 0)

Methods

MethodDescription
New( nTop, nLeft, oWnd, oChild, nW, nH, lPixel, lDesign, cMsg, bWhen, bChange, bGotFocus, bLostFocus, lHorz, lAutoScroll, lDragDrop, nBtnSize, nBkColor, nBorder )Create a new TPager control
ReDefine( nId, oWnd, cMsg, bWhen, bChange, bGotFocus, bLostFocus, nBtnSize, nBkColor, nBorder )Redefine from dialog resource
SetChild( oChild )Set or change the child window contained in the pager
RecalcSize()Recalculate pager size and scroll button visibility
SetPos( nPos )Set the current scroll position (offset)
GetPos()Retrieve the current scroll position
SetButtonSize( nSize )Set the size of the scroll arrow buttons
GetButtonSize()Retrieve the current button size
GetButtonState( nButton )Get the state of a scroll button (PGB_TOPORLEFT or PGB_BOTTOMORRIGHT)
SetBkColor( nColor )Set the background color
GetBkColor()Retrieve the background color
SetBorder( nBorder )Set the border width
GetBorder()Retrieve the border width
ForwardMouse( lForward )Forward mouse events to the child window

Example: Horizontal Pager with Toolbar

#include "FiveWin.ch"

function Main()

   local oWnd, oPager, oToolBar

   DEFINE WINDOW oWnd TITLE "Pager Demo" SIZE 600, 100

   // Create a toolbar with many buttons
   DEFINE BUTTONBAR oToolBar OF oWnd SIZE 800, 30

   DEFINE BUTTON OF oToolBar PROMPT "File"
   DEFINE BUTTON OF oToolBar PROMPT "Edit"
   DEFINE BUTTON OF oToolBar PROMPT "View"
   DEFINE BUTTON OF oToolBar PROMPT "Tools"
   DEFINE BUTTON OF oToolBar PROMPT "Format"
   DEFINE BUTTON OF oToolBar PROMPT "Insert"
   DEFINE BUTTON OF oToolBar PROMPT "Table"
   DEFINE BUTTON OF oToolBar PROMPT "Help"

   // Wrap toolbar in a horizontal pager
   TPager():New( 10, 10, oWnd, oToolBar, 580, 30,,,, .T., .T., .F., 14 )

   ACTIVATE WINDOW oWnd CENTERED

return nil

Notes

See Also