TSelex / TSelector

Fuente: source/classes/tselex.prg, source/classes/selector.prg

Inherits from: TControl (both)

TSelex is a segmented slider control with a draggable thumb that lets users pick from a discrete set of options. TSelector is a circular / radial dial control for selecting a value along an arc. Both provide visual selection with gradient rendering and keyboard/mouse interaction.

TSelex — Segmented Slider

Key DATA Members

DATATypeDescription
aOptionsArrayArray of option labels displayed along the track
bOnSelectCodeblockCode block fired when an option is selected
nOptionNumericCurrently selected option index (1-based)
nClrThumbNumericThumb color (RGB)
aGradOutArrayGradient for the outer track area
aGradInArrayGradient for the inner track area
nRoundNumericCorner radius for the track background

Methods

MethodDescription
New( nRow, nCol, nW, nH, oWnd, lPixel, aOptions, bOnSelect, ... )Create a segmented slider with gradient and thumb parameters
SetOption( nOption )Programmatically select an option by index
GoNext( lRefresh )Move selection to the next option
GoPrev( lRefresh )Move selection to the previous option
AddOption( cText )Append a new option to the slider
InsertOption( cText, nPos )Insert an option at a specific position
DelOption( nOption )Remove an option by index
SetText( cText, nOption )Change the text of an existing option

TSelector — Radial Dial

Key DATA Members

DATATypeDescription
nPosNumericCurrent angular position in radians
nArcNumericTotal arc length in radians
nRadiusNumericDial radius in pixels
nMinNumericMinimum value of the dial range
nMaxNumericMaximum value of the dial range
nMarksNumericNumber of tick marks along the arc (0 = none)
lExactLogicalSnap to nearest tick mark when dragging

Methods

MethodDescription
New( nRow, nCol, bSetGet, nAngle1, nAngle2, nMin, nMax, nMarks, lExact, oWnd, ... )Create a radial dial with angular range and value bounds
Set( nVal )Set the dial to a specific value
nGetPos( nVal )Convert a value to its angular position
nGetVal( nPos )Convert an angular position to its corresponding value
PlaceMark( nPos, nStep )Place a visual tick mark at a position

Example: Segmented Slider and Radial Dial

#include "FiveWin.ch"

function Main()

   local oWnd, oSelex, oSelector, nOpt := 1, nVal := 5

   DEFINE WINDOW oWnd TITLE "TSelex + TSelector Demo" SIZE 400, 300

   @ 20, 20 SELEX oSelex VAR nOpt OPTIONS { "Low", "Med", "High" } ;
        SIZE 200, 30 OF oWnd

   @ 80, 20 SELECTOR oSelector VAR nVal ;
        ANGLES 180, 540 MIN 0 MAX 10 ;
        MARKS 11 EXACT OF oWnd SIZE 120, 120

   ACTIVATE WINDOW oWnd CENTERED

return nil

Notes

Ver También