Sign in Join
Wiki copytemporary

TUpDown: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: TUpDown

OldNewLine
1+The **TUpDown** ![](/wiki-images/7/7d/Tupdown.png) component is two-button control that assists in increment/decrement of some value as determined by its **Min** and **Max** and **Increment** properties. The TUpDown component appears with two arrow buttons pointing up (next) and down (previous), respectively. Min and Max properties are used to set the minimum and maximum values of the TUpDown. The values of the TUpDown component are [[Smallint]] numbers. [[Property]] **Position** represents the currently selected value. If property **ArrowKeys** is [[True]], the TUpDown component can be operated by the keyboard's arrow keys, which would simulate a click on the next or previous button. The **Asscociate** property may link to some other control that gets its value-change instruction from the TUpDown. TUpDown is found on the the [[Common Controls tab]] of the [[Component Palette]].
2+
3+## Runtime creating
4+
5+Here's a simple example creating a TUpDown component at [[runtime]].\
6+First create a form and put a [[TEdit]] component.
7+
8+``` pascal
9+unit Unit1;
10+
11+{$mode objfpc}{$H+}
12+
13+interface
14+
15+uses
16+ Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ComCtrls;
17+
18+type
19+
20+ { TForm1 }
21+
22+ TForm1 = class(TForm)
23+ Edit1: TEdit;
24+ procedure FormCreate(Sender: TObject);
25+ private
26+
27+ public
28+
29+ end;
30+
31+var
32+ Form1: TForm1;
33+
34+implementation
35+
36+{$R *.lfm}
37+
38+{ TForm1 }
39+
40+procedure TForm1.FormCreate(Sender: TObject);
41+var
42+ UpDown1: TUpDown;
43+begin
44+ UpDown1:= TUpDown.Create(Self);
45+ UpDown1.Parent:=Self;
46+ UpDown1.Min := -100;
47+ UpDown1.Max := 100;
48+ UpDown1.Associate := Edit1;
49+end;
50+
51+end.
52+```
53+
54+## see also
55+
56+- [[doc:lcl/comctrls/tupdown.html|TUpDown doc]]
57+- [[TSpinEdit]]
58+
59+---
60+*From the Free Pascal wiki, page "TUpDown", as it stood on 2019-11-21 after a change by Djzepi, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history