@@ -89,9 +89,12 @@ interface
89
89
Data.DB,
90
90
TypInfo,
91
91
{ $IFNDEF CONSOLE}
92
- VCL.Forms,
93
- VCL.StdCtrls,
94
- Vcl.ExtCtrls,
92
+ FMX.Types,
93
+ { $IFDEF FMX}
94
+ FMX.Forms, FMX.Edit, FMX.ListBox, FMX.StdCtrls, FMX.DateTimeCtrls,
95
+ { $ELSE}
96
+ Vcl.Forms, VCL.StdCtrls, Vcl.ExtCtrls,
97
+ { $ENDIF}
95
98
{ $ENDIF}
96
99
System.Classes,
97
100
System.SysUtils;
@@ -139,6 +142,8 @@ implementation
139
142
140
143
uses
141
144
SimpleAttributes,
145
+
146
+
142
147
{ $IFNDEF CONSOLE}
143
148
Vcl.ComCtrls,
144
149
Vcl.Graphics,
@@ -161,20 +166,37 @@ function TSimpleRTTI<T>.__BindValueToComponent(aComponent: TComponent;
161
166
if aComponent is TComboBox then
162
167
(aComponent as TComboBox).ItemIndex := (aComponent as TComboBox).Items.IndexOf(aValue);
163
168
169
+ { $IFDEF VCL}
164
170
if aComponent is TRadioGroup then
165
171
(aComponent as TRadioGroup).ItemIndex := (aComponent as TRadioGroup).Items.IndexOf(aValue);
166
172
173
+ if aComponent is TShape then
174
+ (aComponent as TShape).Brush.Color := aValue;
175
+ { $ENDIF}
176
+
177
+ // DateControls
178
+ { $IFDEF VCL}
179
+ if aComponent is TDateTimePicker then
180
+ (aComponent as TDateTimePicker).Date := aValue;
181
+ { $ENDIF}
182
+ { $IFDEF FMX}
183
+ if aComponent is TDateEdit then
184
+ (aComponent as TDateEdit).Date := aValue;
185
+ { $ENDIF}
186
+
167
187
if aComponent is TCheckBox then
188
+ { $IFDEF VCL}
168
189
(aComponent as TCheckBox).Checked := aValue;
190
+ { $ELSEIF IFDEF FMX}
191
+ (aComponent as TCheckBox).IsChecked := aValue;
192
+ { $ENDIF}
169
193
170
194
if aComponent is TTrackBar then
171
195
(aComponent as TTrackBar).Position := aValue;
172
196
173
- if aComponent is TDateTimePicker then
174
- (aComponent as TDateTimePicker).Date := aValue;
175
197
176
- if aComponent is TShape then
177
- (aComponent as TShape).Brush.Color := aValue;
198
+
199
+
178
200
end ;
179
201
{ $ENDIF}
180
202
@@ -242,20 +264,34 @@ function TSimpleRTTI<T>.__GetComponentToValue(aComponent: TComponent): TValue;
242
264
if aComponent is TComboBox then
243
265
Result := TValue.FromVariant((aComponent as TComboBox).Items[(aComponent as TComboBox).ItemIndex]);
244
266
267
+ { $IFDEF VCL}
245
268
if aComponent is TRadioGroup then
246
269
Result := TValue.FromVariant((aComponent as TRadioGroup).Items[(aComponent as TRadioGroup).ItemIndex]);
247
270
271
+ if aComponent is TShape then
272
+ Result := TValue.FromVariant((aComponent as TShape).Brush.Color);
273
+ { $ENDIF}
274
+
248
275
if aComponent is TCheckBox then
276
+ { $IFDEF VCL}
249
277
Result := TValue.FromVariant((aComponent as TCheckBox).Checked);
278
+ { $ELSEIF IFDEF FMX}
279
+ Result := TValue.FromVariant((aComponent as TCheckBox).IsChecked);
280
+ { $ENDIF}
281
+
250
282
251
283
if aComponent is TTrackBar then
252
284
Result := TValue.FromVariant((aComponent as TTrackBar).Position);
253
285
286
+ { $IFDEF VCL}
254
287
if aComponent is TDateTimePicker then
255
288
Result := TValue.FromVariant((aComponent as TDateTimePicker).DateTime);
289
+ { $ENDIF}
290
+ { $IFDEF FMX}
291
+ if aComponent is TDateEdit then
292
+ Result := TValue.FromVariant((aComponent as TDateEdit).DateTime);
293
+ { $ENDIF}
256
294
257
- if aComponent is TShape then
258
- Result := TValue.FromVariant((aComponent as TShape).Brush.Color);
259
295
260
296
a := Result.TOString;
261
297
end ;
0 commit comments