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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
|
program gaugetest;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Classes, Sysutils
{ you can add units after this },
fpgfx,
gfxbase,
gui_form,
gui_button,
gui_progressbar,
gui_trackbar,
gui_label,
gfx_imgfmt_bmp,
gui_edit,
gui_bevel,
gui_gauge;
type
TGaugeTest = class(TfpgForm)
public
{@VFD_HEAD_BEGIN: GaugeTest}
CloseBtn: TfpgButton;
Gauge: TfpgGauge;
MinusBtn: TfpgButton;
PlusBtn: TfpgButton;
ProgressBar: TfpgProgressBar;
TrackBar: TfpgTrackBar;
VertGauge: TfpgGauge;
TextGauge: TfpgGauge;
lblName1: TfpgLabel;
lblName2: TfpgLabel;
lblName3: TfpgLabel;
lblName4: TfpgLabel;
NeedleGauge: TfpgGauge;
PieGauge: TfpgGauge;
DialGauge: TfpgGauge;
lblName5: TfpgLabel;
lblName6: TfpgLabel;
lblName7: TfpgLabel;
SmallNeedle: TfpgGauge;
{@VFD_HEAD_END: GaugeTest}
procedure AfterCreate; override;
procedure OnCloseClick (Sender:TObject);
procedure OnPlusClick (Sender:TObject);
procedure OnMinusClick (Sender:TObject);
procedure OnTrackBarChange (Sender: TObject; APosition: integer);
end;
{@VFD_NEWFORM_DECL}
procedure TGaugeTest.AfterCreate;
begin
{@VFD_BODY_BEGIN: GaugeTest}
Name := 'GaugeTest';
SetPosition(83, 160, 595, 379);
WindowTitle := 'Gauge Test';
WindowPosition:= wpScreenCenter;
Sizeable := False;
CloseBtn := TfpgButton.Create(self);
with CloseBtn do
begin
Name := 'CloseBtn';
SetPosition(463, 329, 75, 24);
Anchors := [anRight,anBottom];
Text := 'Close';
FontDesc := '#Label1';
ImageName := 'stdimg.close';
ModalResult := 1;
OnClick:= @OnCloseClick;
end;
Gauge := TfpgGauge.Create(self);
with Gauge do
begin
Name := 'Gauge';
SetPosition(124, 104, 150, 25);
Kind := gkHorizontalBar;
end;
MinusBtn := TfpgButton.Create(self);
with MinusBtn do
begin
Name := 'MinusBtn';
SetPosition(116, 329, 24, 24);
Anchors := [anLeft,anBottom];
Text := '-';
FontDesc := '#Label1';
ImageName := '';
OnClick:= @OnMinusClick;
end;
PlusBtn := TfpgButton.Create(self);
with PlusBtn do
begin
Name := 'PlusBtn';
SetPosition(384, 329, 24, 24);
Anchors := [anLeft,anBottom];
Text := '+';
FontDesc := '#Label1';
ImageName := '';
OnClick:= @OnPlusClick;
end;
ProgressBar := TfpgProgressBar.Create(self);
with ProgressBar do
begin
Name := 'ProgressBar';
SetPosition(124, 16, 150, 22);
ShowCaption := True;
end;
TrackBar := TfpgTrackBar.Create(self);
with TrackBar do
begin
Name := 'TrackBar';
SetPosition(164, 325, 200, 30);
Anchors := [anLeft,anBottom];
OnChange := @OnTrackBarChange;
end;
VertGauge := TfpgGauge.Create(self);
with VertGauge do
begin
Name := 'VertGauge';
SetPosition(352, 32, 25, 100);
Kind := gkVerticalBar;
ShowText := False;
end;
TextGauge := TfpgGauge.Create(self);
with TextGauge do
begin
Name := 'TextGauge';
SetPosition(124, 60, 75, 25);
Kind := gkText;
end;
lblName1 := TfpgLabel.Create(self);
with lblName1 do
begin
Name := 'lblName1';
SetPosition(16, 20, 92, 16);
Text := 'Progress Bar';
FontDesc := '#Label1';
end;
lblName2 := TfpgLabel.Create(self);
with lblName2 do
begin
Name := 'lblName2';
SetPosition(16, 64, 80, 16);
Text := 'Text Gauge';
FontDesc := '#Label1';
end;
lblName3 := TfpgLabel.Create(self);
with lblName3 do
begin
Name := 'lblName3';
SetPosition(16, 108, 108, 16);
Text := 'Horizontal Gauge';
FontDesc := '#Label1';
end;
lblName4 := TfpgLabel.Create(self);
with lblName4 do
begin
Name := 'lblName4';
SetPosition(324, 12, 96, 16);
Text := 'Vertical Gauge';
FontDesc := '#Label1';
end;
NeedleGauge := TfpgGauge.Create(self);
with NeedleGauge do
begin
Name := 'NeedleGauge';
SetPosition(472, 40, 100, 50);
Kind := gkNeedle;
end;
PieGauge := TfpgGauge.Create(self);
with PieGauge do
begin
Name := 'PieGauge';
SetPosition(124, 156, 120, 120);
Kind := gkPie;
end;
DialGauge := TfpgGauge.Create(self);
with DialGauge do
begin
Name := 'DialGauge';
SetPosition(356, 156, 120, 120);
Kind := gkDial;
end;
lblName5 := TfpgLabel.Create(self);
with lblName5 do
begin
Name := 'lblName5';
SetPosition(152, 288, 80, 16);
Text := 'Pie Gauge';
FontDesc := '#Label1';
end;
lblName6 := TfpgLabel.Create(self);
with lblName6 do
begin
Name := 'lblName6';
SetPosition(384, 288, 80, 16);
Text := 'Dial Gauge';
FontDesc := '#Label1';
end;
lblName7 := TfpgLabel.Create(self);
with lblName7 do
begin
Name := 'lblName7';
SetPosition(476, 100, 100, 16);
Text := 'Needle Gauge';
FontDesc := '#Label1';
end;
SmallNeedle := TfpgGauge.Create(self);
with SmallNeedle do
begin
Name := 'SmallNeedle';
SetPosition(504, 160, 64, 32);
Kind := gkNeedle;
end;
{@VFD_BODY_END: GaugeTest}
end;
procedure TGaugeTest.OnCloseClick(Sender: TObject);
begin
Close;
end;
procedure TGaugeTest.OnPlusClick(Sender: TObject);
begin
TrackBar.Position:= TrackBar.Position + 5;
TrackBar.Invalidate;
OnTrackBarChange(self,TrackBar.Position);
end;
procedure TGaugeTest.OnMinusClick(Sender: TObject);
begin
TrackBar.Position:= TrackBar.Position - 5;
TrackBar.Invalidate;
OnTrackBarChange(self,TrackBar.Position);
end;
procedure TGaugeTest.OnTrackBarChange(Sender: TObject; APosition: integer);
begin
Gauge.Progress := APosition;
ProgressBar.Position := APosition;
VertGauge.Progress := APosition;
TextGauge.Progress := APosition;
NeedleGauge.Progress := APosition;
PieGauge.Progress := APosition;
DialGauge.Progress := APosition;
SmallNeedle.Progress := APosition;
end;
procedure MainProc;
var
frm: TGaugeTest;
begin
fpgApplication.Initialize;
frm := TGaugeTest.Create(nil);
try
frm.Show;
fpgApplication.Run;
finally
frm.Free;
end;
end;
begin
MainProc
end.
|