TTrackBar

Fuente: source/classes/trackbar.prg

Inherits from: TControl

TTrackBar wraps the Win32 trackbar common control (slider). It allows the user to select a numeric value by dragging a thumb along a track, with optional tick marks. It is commonly used for volume controls, brightness sliders, and any ranged value input.

Key DATA Members

DATATypeDescription
nMinNumericMinimum value of the trackbar range
nMaxNumericMaximum value of the trackbar range
nPosNumericCurrent thumb position
nFreqNumericTick mark frequency
bChangeBlockCode block executed when the position changes

Methods

MethodDescription
New( nRow, nCol, oWnd, nW, nH, nMin, nMax, nPos, nFreq )Create a new trackbar control
SetPos( n )Set the thumb to position n
GetPos()Return the current thumb position
SetRange( nMin, nMax )Set the minimum and maximum range values
SetTicFreq( n )Set the tick-mark frequency

Example: Volume Control 0-255

#include "FiveWin.ch"

function Main()

   local oWnd, oTrack, nVol := 128

   DEFINE WINDOW oWnd TITLE "Volume Control" SIZE 400, 150

   @ 40, 20 TRACKBAR oTrack VAR nVol ;
      SIZE 360, 30 OF oWnd ;
      RANGE 0, 255 ;
      ON CHANGE ( oWnd:SetText( "Volume: " + Str( nVol ) ) )

   ACTIVATE WINDOW oWnd CENTERED

return nil

Notes

Ver También