TScrollMetro

Fonte: source/classes/scrollm.prg

Inherits from: TControl

TScrollMetro provides a modern Metro-style scrollbar control. It replaces the classic Windows scrollbar with a flat, touch-friendly design suitable for tablet and modern UI applications. The control supports programmatic positioning, range management, and code-block event hooks for all scroll actions.

Key DATA Members

DATATypeDescription
lVerticalLogicalOrientation: .T. for vertical, .F. for horizontal
nMin / nMaxNumericScroll range minimum and maximum values
nPgStepNumericPage step increment for page-up/page-down actions
nPosNumericCurrent scroll thumb position
bGoUp / bGoDownCode blockExecuted when the up/left or down/right button is clicked
bGoTop / bGoBottomCode blockExecuted when the thumb is dragged to the top or bottom
bPageUp / bPageDownCode blockExecuted on page-up/page-down track area click
bPos / bTrackCode blockExecuted on position change and thumb tracking

Methods

MethodDescription
New( nRow, nCol, nMin, nMax, nPgStep, lVert, oWnd, nW, nH )Create a new Metro scrollbar with range, step, and orientation
SetRange()Update the scroll range from nMin and nMax values
SetPos( nPos ) / GetPos()Set or retrieve the current scroll thumb position
GoUp() / GoDown()Move the thumb up (or left) / down (or right) by one step
GoTop() / GoBottom()Move the thumb to the minimum or maximum position
PageUp() / PageDown()Move the thumb by the page step amount

Example: Vertical Scrollbar for Browse

#include "FiveWin.ch"

function Main()

   local oWnd, oScroll
   local nPos := 0

   DEFINE WINDOW oWnd TITLE "TScrollMetro Demo" SIZE 400, 300

   oScroll := TScrollMetro():New( 10, 370, 0, 100, 10, .T., oWnd, 20, 250 )

   oScroll:bGoUp    := { || nPos := oScroll:GetPos(), oWnd:Refresh() }
   oScroll:bGoDown  := { || nPos := oScroll:GetPos(), oWnd:Refresh() }
   oScroll:bPageUp  := { || nPos := oScroll:GetPos(), oWnd:Refresh() }
   oScroll:bPageDown:= { || nPos := oScroll:GetPos(), oWnd:Refresh() }

   ACTIVATE WINDOW oWnd CENTERED

return nil

Notes

Veja Também