Skip to content

Commit 83f4e69

Browse files
authored
Merge pull request academiadocodigo#40 from reinaldoacdc/FkCombobox
Atribuir o Items.Objects ao valor do Combobox
2 parents b1b8773 + c74d077 commit 83f4e69

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

SimpleRTTI.pas

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ function TSimpleRTTI<T>.__BindValueToComponent(aComponent: TComponent;
166166
(aComponent as TEdit).Text := aValue;
167167

168168
if aComponent is TComboBox then
169-
(aComponent as TComboBox).ItemIndex := (aComponent as TComboBox).Items.IndexOf(aValue);
169+
(aComponent as TComboBox).ItemIndex := (aComponent as TComboBox).Items.IndexOfObject(TObject(Integer(aValue)));
170170

171171
{$IFDEF VCL}
172172
if aComponent is TRadioGroup then
@@ -256,7 +256,7 @@ function TSimpleRTTI<T>.__GetComponentToValue(aComponent: TComponent): TValue;
256256
Result := TValue.FromVariant((aComponent as TEdit).Text);
257257

258258
if aComponent is TComboBox then
259-
Result := TValue.FromVariant((aComponent as TComboBox).Items[(aComponent as TComboBox).ItemIndex]);
259+
Result := Integer((aComponent as TComboBox).Items.Objects[(aComponent as TComboBox).ItemIndex]);
260260

261261
{$IFDEF VCL}
262262
if aComponent is TRadioGroup then

0 commit comments

Comments
 (0)