TDbComboBox has problems to set data when item changes
Original Reporter info from Mantis: stephanie
-
Reporter name: Stephanie
Original Reporter info from Mantis: stephanie
- Reporter name: Stephanie
Description:
Hello, I've noted that when the user changes the item in a TDbComboBox the associted data is not always changed. When the user moves to other controls, oft the value is automatically setted to the previous value. It is quiete difficolut to reproduce, I think when a Post command happens when the user move among the controls, set the previous values.
I've added a showmessage in the Change event, and also in the Exit event, the DbComboBox.Text is correct but the Field.AsString values remains to the old values.
In order to resolve the problem, I've made this patch on /lcl/include/customdbcombobox.inc:
procedure TCustomDBComboBox.Change;
begin
FDataLink.Modified;
//My new code:
try
if FDataLink.CanModify then begin
FDataLink.Field.AsString := Text;
FDatalink.Modified;
end;
finally
inherited Change;
end;
//Commented the old code because already in the finally of my code
{inherited Change;}
end;
The patch seems to work correctly.
Best regards,
Stephanie