TUpDown

Source: source/classes/tupdown.prg

Inherits from: TControl

TUpDown wraps the Win32 up-down common control, also known as a spinner or buddy control. It is typically paired with a TGet field to provide increment/decrement arrow buttons that automatically update the buddy's value within a configurable range.

Key DATA Members

DATATypeDescription
nMinNumericMinimum value of the spinner range
nMaxNumericMaximum value of the spinner range
nPosNumericCurrent spinner position
oBuddyObjectThe buddy control (usually a TGet) linked to this spinner
lWrapLogicalWrap around when reaching the range boundary
nAlignNumericAlignment relative to the buddy: 0=right, 1=left

Methods

MethodDescription
New( nRow, nCol, oWnd, oBuddy, nW, nH, nMin, nMax, nPos )Create a new up-down control
SetPos( n )Set the spinner position to n
GetPos()Return the current spinner position
SetRange( nMin, nMax )Set the minimum and maximum range values
SetBuddy( oBuddy )Attach a buddy control to the spinner
GetBuddy()Return the currently attached buddy control

Example: Spinner Linked to a GET Field

#include "FiveWin.ch"

function Main()

   local oWnd, oGet, oSpinner, nVal := 5

   DEFINE WINDOW oWnd TITLE "Quantity" SIZE 300, 150

   @ 40, 20 GET oGet VAR nVal SIZE 60, 20 OF oWnd PICTURE "999"
   @ 38, 80 UPDOWN oSpinner BUDDY oGet ;
      RANGE 1, 100

   ACTIVATE WINDOW oWnd CENTERED

return nil

Notes

See Also