Sign in Join
Wiki copytemporary

TUpDown/zh CN: what changed

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

Title: TUpDown/zh CN

OldNewLine
1+**TUpDown** ![](/wiki-images/7/7d/Tupdown.png) 控件是两个按钮,附在别的可编辑控件上,通过 **Min** 和 **Max** 和 **Increment**属性来调整别的控件的内容 此控件包含两个箭头按钮,一个上一个下,也可以横向放置。 Min和Max 来设置控件的最大值和最小值,这里的值是 [[Smallint]]类型. [[Property]] **Position** 表示当前值. 加入属性 **ArrowKeys** 为 [[True]], 则可以通过键盘的上下键控制, 模拟上一个和下一个的点击.
2+
3+**`Asscociate`**` 属性来连接其他可编辑控件,然后将命令发送到对应的控件。`
4+
5+在[[Common Controls tab]] 的 [[Component Palette]].
6+
7+## Runtime creating
8+
9+我们来看一个简单的样例 [[runtime]].\
10+首先添加一个 [[TEdit]] 控件.
11+
12+``` pascal
13+unit Unit1;
14+
15+{$mode objfpc}{$H+}
16+
17+interface
18+
19+uses
20+ Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ComCtrls;
21+
22+type
23+
24+ { TForm1 }
25+
26+ TForm1 = class(TForm)
27+ Edit1: TEdit;
28+ procedure FormCreate(Sender: TObject);
29+ private
30+
31+ public
32+
33+ end;
34+
35+var
36+ Form1: TForm1;
37+
38+implementation
39+
40+{$R *.lfm}
41+
42+{ TForm1 }
43+
44+procedure TForm1.FormCreate(Sender: TObject);
45+var
46+ UpDown1: TUpDown;
47+begin
48+ UpDown1:= TUpDown.Create(Self);
49+ UpDown1.Parent:=Self;
50+ UpDown1.Min := -100;
51+ UpDown1.Max := 100;
52+ UpDown1.Associate := Edit1;
53+end;
54+
55+end.
56+```
57+
58+## see also
59+
60+- [[doc:lcl/comctrls/tupdown.html|TUpDown doc]]
61+- [[TSpinEdit]]
62+
63+---
64+*From the Free Pascal wiki, page "TUpDown/zh CN", as it stood on 2020-04-23 after a change by TyphonFinger, 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