TScrollBar

Fuente: source/classes/scrllbar.prg

Inherits from: TControl

TScrollBar is a standalone scrollbar control that can be placed independently within a window or dialog. Unlike window automatic scroll bars, TScrollBar is a control object that fires action blocks when the user scrolls, making it suitable for custom browse panels, range selectors, and scrollable containers.

Key DATA Members

DATATypeDescription
nMinNumericMinimum scrollbar value
nMaxNumericMaximum scrollbar value
nPgStepNumericPage-step increment for the scrollbar
lVerticalLogical.T. for vertical scrollbar, .F. for horizontal
bGoUpBlockAction on small increment (down arrow / right arrow)
bGoDownBlockAction on small decrement
bGoTopBlockAction on reaching the top/left extreme
bGoBottomBlockAction on reaching the bottom/right extreme
bPageUpBlockAction on page increment (click above the thumb)
bPageDownBlockAction on page decrement

Methods

MethodDescription
New( nRow, nCol, nMin, nMax, nPgStep, lVert, oWnd )Create a new scrollbar control
WinNew( nMin, nMax, nPgStep, lVert, oWnd )Create a scrollbar using window coordinates
GoUp()Scroll up/right by one step
GoDown()Scroll down/left by one step
GoTop()Scroll to the minimum position
GoBottom()Scroll to the maximum position
PageUp()Scroll up by one page step
PageDown()Scroll down by one page step
SetPos( n )Set the thumb position to n
GetPos()Return the current thumb position

Example: Vertical Scrollbar Linked to Browse

#include "FiveWin.ch"

function Main()

   local oWnd, oScroll, nPos := 1

   DEFINE WINDOW oWnd TITLE "ScrollBar Demo" SIZE 300, 300

   @ 10, 260 SCROLLBAR oScroll ;
      RANGE 1, 100 ;
      PAGE 10 ;
      VERTICAL OF oWnd ;
      ON UP nPos-- ;
      ON DOWN nPos++

   ACTIVATE WINDOW oWnd CENTERED

return nil

Notes

Ver También