mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 21:49:23 +02:00
lcl: TDBLookup - scroll dataset even if ControlLink not active
git-svn-id: trunk@34763 -
This commit is contained in:
parent
436bf0df59
commit
77a190e12c
@ -334,22 +334,25 @@ var
|
|||||||
Key: Variant;
|
Key: Variant;
|
||||||
SavedEvent: TNotifyEvent;
|
SavedEvent: TNotifyEvent;
|
||||||
begin
|
begin
|
||||||
if not FControlLink.Active or (ValueIndex < 0) or (ValueIndex >= Length(FListKeys)) then
|
if (ValueIndex < 0) or (ValueIndex >= Length(FListKeys)) then
|
||||||
Exit;
|
Exit;
|
||||||
Key := FListKeys[ValueIndex];
|
Key := FListKeys[ValueIndex];
|
||||||
if VarSameValue(Key, FControlLink.DataSet.FieldValues[FDataFieldNames]) then
|
if FControlLink.Active then
|
||||||
Exit;
|
|
||||||
SavedEvent := FControlLink.OnDataChange;
|
|
||||||
FControlLink.OnDataChange := nil;
|
|
||||||
FControlLink.Modified;
|
|
||||||
FControlLink.Edit;
|
|
||||||
FControlLink.OnDataChange := SavedEvent;
|
|
||||||
if FDataFields.Count = 1 then
|
|
||||||
TField(FDataFields[0]).Value := Key
|
|
||||||
else
|
|
||||||
begin
|
begin
|
||||||
for I := 0 to FDataFields.Count -1 do
|
if VarSameValue(Key, FControlLink.DataSet.FieldValues[FDataFieldNames]) then
|
||||||
TField(FDataFields[I]).Value := Key[I];
|
Exit;
|
||||||
|
SavedEvent := FControlLink.OnDataChange;
|
||||||
|
FControlLink.OnDataChange := nil;
|
||||||
|
FControlLink.Modified;
|
||||||
|
FControlLink.Edit;
|
||||||
|
FControlLink.OnDataChange := SavedEvent;
|
||||||
|
if FDataFields.Count = 1 then
|
||||||
|
TField(FDataFields[0]).Value := Key
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
for I := 0 to FDataFields.Count -1 do
|
||||||
|
TField(FDataFields[I]).Value := Key[I];
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
if ScrollDataset then
|
if ScrollDataset then
|
||||||
FListLink.DataSet.Locate(FKeyFieldNames, Key, []);
|
FListLink.DataSet.Locate(FKeyFieldNames, Key, []);
|
||||||
|
Loading…
Reference in New Issue
Block a user