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
|
program edittest;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Classes, fpgfx, gui_form, gui_label, gui_edit, gui_button, gui_radiobutton,
gui_listbox, gfxbase;
type
{ TMainForm }
TMainForm = class(TfpgForm)
private
procedure btnQuitClicked(Sender: TObject);
procedure rbClicked(Sender: TObject);
procedure lbChange(Sender: TObject);
public
{@VFD_HEAD_BEGIN: MainForm}
lblName1: TfpgLabel;
edtText: TfpgEdit;
lblName2: TfpgLabel;
lblName3: TfpgLabel;
edtInteger: TfpgEditInteger;
edtFloat: TfpgEditFloat;
btnQuit: TfpgButton;
rbPoint: TfpgRadioButton;
rbComma: TfpgRadioButton;
lbNegativeColor: TfpgColorListBox;
lblNegativeColor: TfpgLabel;
{@VFD_HEAD_END: MainForm}
procedure AfterCreate; override;
end;
{@VFD_NEWFORM_DECL}
{@VFD_NEWFORM_IMPL}
procedure TMainForm.btnQuitClicked(Sender: TObject);
begin
Close;
end;
procedure TMainForm.rbClicked(Sender: TObject);
begin
if Sender is TfpgRadioButton then
if (Sender as TfpgRadioButton).tag = 0 then
edtFloat.DecimalSeparator := '.'
else
edtFloat.DecimalSeparator := ',';
end;
procedure TMainForm.lbChange(Sender: TObject);
begin
edtFloat.NegativeColor := lbNegativeColor.Color;
edtInteger.NegativeColor := lbNegativeColor.Color;
end;
procedure TMainForm.AfterCreate;
begin
{@VFD_BODY_BEGIN: MainForm}
Name := 'MainForm';
SetPosition(376, 202, 392, 239);
WindowTitle := 'Edit components';
WindowPosition := wpScreenCenter;
lblName1 := TfpgLabel.Create(self);
with lblName1 do
begin
Name := 'lblName1';
SetPosition(8, 8, 196, 16);
FontDesc := '#Label1';
Text := 'Text Edit';
end;
edtText := TfpgEdit.Create(self);
with edtText do
begin
Name := 'edtText';
SetPosition(24, 28, 120, 22);
TabOrder := 1;
Text := '';
FontDesc := '#Edit1';
end;
lblName2 := TfpgLabel.Create(self);
with lblName2 do
begin
Name := 'lblName2';
SetPosition(8, 68, 80, 16);
FontDesc := '#Label1';
Text := 'Integer Edit';
end;
lblName3 := TfpgLabel.Create(self);
with lblName3 do
begin
Name := 'lblName3';
SetPosition(8, 124, 80, 16);
FontDesc := '#Label1';
Text := 'Float Edit';
end;
edtInteger := TfpgEditInteger.Create(self);
with edtInteger do
begin
Name := 'edtInteger';
SetPosition(24, 88, 120, 22);
end;
edtFloat := TfpgEditFloat.Create(self);
with edtFloat do
begin
Name := 'edtFloat';
SetPosition(24, 144, 120, 22);
end;
btnQuit := TfpgButton.Create(self);
with btnQuit do
begin
Name := 'btnQuit';
SetPosition(296, 199, 75, 24);
Anchors := [anRight,anBottom];
Text := 'Quit';
FontDesc := '#Label1';
ImageName := '';
TabOrder := 6;
OnClick := @btnQuitClicked;
end;
rbPoint := TfpgRadioButton.Create(self);
with rbPoint do
begin
Name := 'rbPoint';
SetPosition(160, 136, 184, 20);
Checked := True;
FontDesc := '#Label1';
GroupIndex := 1;
TabOrder := 7;
Text := 'Point as DecimalSeparator';
Tag := 0;
OnChange := @rbClicked;
end;
rbComma := TfpgRadioButton.Create(self);
with rbComma do
begin
Name := 'rbComma';
SetPosition(160, 160, 196, 20);
FontDesc := '#Label1';
GroupIndex := 1;
TabOrder := 8;
Text := 'Comma as DecimalSeparator';
Tag := 1;
OnChange := @rbClicked;
end;
lbNegativeColor := TfpgColorListBox.Create(self);
with lbNegativeColor do
begin
Name := 'lbNegativeColor';
SetPosition(200, 28, 176, 92);
Color := clRed;
OnChange := @lbChange;
end;
lblNegativeColor := TfpgLabel.Create(self);
with lblNegativeColor do
begin
Name := 'lblNegativeColor';
SetPosition(196, 8, 188, 16);
FontDesc := '#Label1';
Text := 'Choose color for negative num.';
end;
{@VFD_BODY_END: MainForm}
if edtFloat.DecimalSeparator = '.' then
rbPoint.Checked := True
else
rbComma.Checked := True;
end;
procedure MainProc;
var
frm: TMainForm;
begin
fpgApplication.Initialize;
frm := TMainForm.Create(nil);
try
frm.Show;
fpgApplication.Run;
finally
frm.Free;
end;
end;
begin
MainProc;
end.
|