LCL: Fix some data control regressions. Issue #35458, patch from Michal Gawrycki.

git-svn-id: trunk@61111 -
This commit is contained in:
juha 2019-05-03 13:53:21 +00:00
parent 1d8e8b2751
commit 7de7e2642e
2 changed files with 17 additions and 8 deletions

View File

@ -473,6 +473,7 @@ Type
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
procedure Loaded; override;
procedure UpdateData(Sender: TObject); override;
function IsUnbound: boolean;
public
constructor Create(AOwner: TComponent); override;
property KeyValue: Variant read GetKeyValue write SetKeyValue;

View File

@ -30,6 +30,11 @@ begin
FLookup.UpdateData(ItemIndex, FScrollListDataset);
end;
function TDBLookupListBox.IsUnbound: boolean;
begin
Result := (FDataLink.DataSource = nil) or (DataField = '');
end;
procedure TDBLookupListBox.ActiveChange(Sender: TObject);
begin
if FDataLink.Active then
@ -54,15 +59,18 @@ end;
procedure TDBLookupListBox.DoSelectionChange(User: Boolean);
begin
if User then
begin
if FDataLink.CanModify then
begin
FDataLink.Modified;
FDataLink.UpdateRecord;
end
if IsUnbound then
UpdateData(Self)
else
DataChange(Self);
end;
begin
if FDataLink.CanModify then
begin
FDataLink.Modified;
FDataLink.UpdateRecord;
end
else
DataChange(Self);
end;
inherited DoSelectionChange(User);
end;