mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-24 00:27:06 +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;
|
||||
SavedEvent: TNotifyEvent;
|
||||
begin
|
||||
if not FControlLink.Active or (ValueIndex < 0) or (ValueIndex >= Length(FListKeys)) then
|
||||
if (ValueIndex < 0) or (ValueIndex >= Length(FListKeys)) then
|
||||
Exit;
|
||||
Key := FListKeys[ValueIndex];
|
||||
if VarSameValue(Key, FControlLink.DataSet.FieldValues[FDataFieldNames]) 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
|
||||
if FControlLink.Active then
|
||||
begin
|
||||
for I := 0 to FDataFields.Count -1 do
|
||||
TField(FDataFields[I]).Value := Key[I];
|
||||
if VarSameValue(Key, FControlLink.DataSet.FieldValues[FDataFieldNames]) 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
|
||||
for I := 0 to FDataFields.Count -1 do
|
||||
TField(FDataFields[I]).Value := Key[I];
|
||||
end;
|
||||
end;
|
||||
if ScrollDataset then
|
||||
FListLink.DataSet.Locate(FKeyFieldNames, Key, []);
|
||||
|
Loading…
Reference in New Issue
Block a user