This repository has been archived by the owner on Mar 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hold.pas
97 lines (86 loc) · 2.25 KB
/
hold.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
unit Hold;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, ExtCtrls, Buttons, Spin;
type
THoldIndtastning = class(TForm)
Panel1: TPanel;
Panel2: TPanel;
ListBox1: TListBox;
ListBox2: TListBox;
Label1: TLabel;
ComboBox1: TComboBox;
Label2: TLabel;
SpinEdit1: TSpinEdit;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Panel3: TPanel;
Label3: TLabel;
Button1: TButton;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
constructor Create;
{ Public declarations }
end;
var
HoldIndtastning: THoldIndtastning;
implementation
{$R *.DFM}
constructor THoldIndtastning.Create;
begin
ListBox1.ItemIndex := 0;
end;
procedure THoldIndtastning.BitBtn1Click(Sender: TObject);
var
index : Integer;
begin
index := ListBox1.Itemindex;
if ListBox2.Items.Count < 4 then
begin
ListBox2.Items.Add(ListBox1.Items[index]);
ListBox1.Items.Delete(index);
ListBox2.ItemIndex := 0;
if ListBox2.Items.Count = 4 then
BitBtn1.Enabled := False;
end;
if ListBox1.Items.Count = 0 then
BitBtn1.Enabled := False
else
begin
if ListBox1.Items.Count > index then
ListBox1.ItemIndex := index
else
ListBox1.ItemIndex := index - 1;
end;
if ListBox2.Items.Count > 0 then
BitBtn2.Enabled := True;
end;
procedure THoldIndtastning.BitBtn2Click(Sender: TObject);
var
index : Integer;
begin
index := ListBox2.Itemindex;
ListBox1.Items.Add(ListBox2.Items[index]);
ListBox2.Items.Delete(index);
if ListBox2.Items.Count = 0 then
BitBtn2.Enabled := False
else
begin
if ListBox2.Items.Count > index then
ListBox2.ItemIndex := index
else
ListBox2.ItemIndex := index - 1;
end;
if ListBox1.Items.Count > 0 then
BitBtn1.Enabled := True;
end;
procedure THoldIndtastning.Button1Click(Sender: TObject);
begin
Close;
end;
end.