-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfTemp.pas
97 lines (81 loc) · 2.11 KB
/
fTemp.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
unit fTemp;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Samples.Spin,
Vcl.ComCtrls, Vcl.Imaging.jpeg, Vcl.ExtCtrls,unHelpForms;
type
TfrmTemp = class(TDefDevForm)
pnlSound: TPanel;
Image3: TImage;
Label2: TLabel;
RichEdit1: TRichEdit;
GroupBox1: TGroupBox;
Label1: TLabel;
Label3: TLabel;
SpinEdit1: TSpinEdit;
ComboBox1: TComboBox;
SpinEdit2: TSpinEdit;
procedure SpinEdit1Change(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure ComboBox1Change(Sender: TObject);
procedure SpinEdit2Change(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
procedure SetComboFromValue(val: integer);
{ Private declarations }
public
{ Public declarations }
end;
var
frmTemp: TfrmTemp;
implementation
uses unDevices;
{$R *.dfm}
procedure TfrmTemp.ComboBox1Change(Sender: TObject);
begin
case ComboBox1.itemindex of
0: spinedit2.Value:=11;
1: spinedit2.Value:=22;
2: spinedit2.Value:=21;
3: spinedit2.Value:=21;
else spinedit2.Value:=22;
end;
if fileexists(AppPath+'\images\DHT'+inttostr(spinedit2.Value)+'.jpg') then
Begin
image3.Picture.LoadFromFile(AppPath+'\images\DHT'+inttostr(spinedit2.Value)+'.jpg');
End;
end;
procedure TfrmTemp.SetComboFromValue(val:integer);
Begin
case val of
11:Combobox1.ItemIndex:=0;
22:Combobox1.ItemIndex:=1;
21:Combobox1.ItemIndex:=2;
else Combobox1.ItemIndex:=1;
end;
ComboBox1Change(nil);
End;
procedure TfrmTemp.FormCreate(Sender: TObject);
begin
// ComboBox1.ItemIndex:=1;
end;
procedure TfrmTemp.FormShow(Sender: TObject);
begin
Param1SE:=SpinEdit1;
SpinEdit1.MaxValue:=arduino.MaxPins;
Param2SE:=SpinEdit2;
SetComboFromValue(SpinEdit2.Value);
end;
procedure TfrmTemp.SpinEdit1Change(Sender: TObject);
begin
SetParam(1,TSpinEdit(Sender));
end;
procedure TfrmTemp.SpinEdit2Change(Sender: TObject);
begin
if SpinEdit2.Value=0 then
SetComboFromValue(0)
else
SetParam(2,TSpinEdit(Sender));
end;
end.