mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-28 17:00:57 +02:00
LCL: Fix some data control regressions. Issue #35458, patch from Michal Gawrycki.
git-svn-id: trunk@61111 -
This commit is contained in:
parent
1d8e8b2751
commit
7de7e2642e
@ -473,6 +473,7 @@ Type
|
|||||||
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
|
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
|
||||||
procedure Loaded; override;
|
procedure Loaded; override;
|
||||||
procedure UpdateData(Sender: TObject); override;
|
procedure UpdateData(Sender: TObject); override;
|
||||||
|
function IsUnbound: boolean;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
property KeyValue: Variant read GetKeyValue write SetKeyValue;
|
property KeyValue: Variant read GetKeyValue write SetKeyValue;
|
||||||
|
@ -30,6 +30,11 @@ begin
|
|||||||
FLookup.UpdateData(ItemIndex, FScrollListDataset);
|
FLookup.UpdateData(ItemIndex, FScrollListDataset);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TDBLookupListBox.IsUnbound: boolean;
|
||||||
|
begin
|
||||||
|
Result := (FDataLink.DataSource = nil) or (DataField = '');
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TDBLookupListBox.ActiveChange(Sender: TObject);
|
procedure TDBLookupListBox.ActiveChange(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if FDataLink.Active then
|
if FDataLink.Active then
|
||||||
@ -54,15 +59,18 @@ end;
|
|||||||
procedure TDBLookupListBox.DoSelectionChange(User: Boolean);
|
procedure TDBLookupListBox.DoSelectionChange(User: Boolean);
|
||||||
begin
|
begin
|
||||||
if User then
|
if User then
|
||||||
begin
|
if IsUnbound then
|
||||||
if FDataLink.CanModify then
|
UpdateData(Self)
|
||||||
begin
|
|
||||||
FDataLink.Modified;
|
|
||||||
FDataLink.UpdateRecord;
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
DataChange(Self);
|
begin
|
||||||
end;
|
if FDataLink.CanModify then
|
||||||
|
begin
|
||||||
|
FDataLink.Modified;
|
||||||
|
FDataLink.UpdateRecord;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
DataChange(Self);
|
||||||
|
end;
|
||||||
inherited DoSelectionChange(User);
|
inherited DoSelectionChange(User);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user