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