mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-11 10:59:16 +02:00
LCL, fix exception caused by dblookup controls opening dataset, from Leslie Kaye, issue #14197
git-svn-id: trunk@21161 -
This commit is contained in:
parent
e5289a924c
commit
d43265773b
@ -151,6 +151,7 @@ Type
|
||||
procedure LinkGetBookMark;
|
||||
procedure LinkGotoBookMark;
|
||||
procedure SetKeyFieldName(const Value: string);
|
||||
procedure SetListFieldName(const Value: string);
|
||||
procedure SetListSource(Value: TDataSource);
|
||||
procedure SetLookupCache(const Value: boolean);
|
||||
protected
|
||||
@ -166,7 +167,7 @@ Type
|
||||
// properties to be published by owner control
|
||||
// these are not used where data control Field is dbLookup
|
||||
property KeyField: string read GetKeyFieldName write SetKeyFieldName;
|
||||
property ListField: string read FListFieldName write FListFieldName;
|
||||
property ListField: string read FListFieldName write SetListFieldName;
|
||||
property ListFieldIndex: Integer read FListFieldIndex write FListFieldIndex default 0;
|
||||
property ListSource: TDataSource read GetListSource write SetListSource;
|
||||
end;
|
||||
|
@ -122,6 +122,12 @@ begin
|
||||
FKeyFieldNames := Value;
|
||||
end;
|
||||
|
||||
procedure TDBLookup.SetListFieldName(const Value: string);
|
||||
begin
|
||||
FListFieldName := Value;
|
||||
FListLink.FieldName := Value;
|
||||
end;
|
||||
|
||||
procedure TDBLookup.SetListSource(Value: TDataSource);
|
||||
begin
|
||||
if FListSource = Value then
|
||||
@ -249,11 +255,16 @@ begin
|
||||
|
||||
if (FKeyFieldNames > '') and Assigned(FListLink.Dataset) then
|
||||
begin
|
||||
ListFields := TList.Create;
|
||||
FListLinkTmpSetActive := not FListLink.DataSet.Active;
|
||||
if FListLinkTmpSetActive then
|
||||
try
|
||||
FListLink.DataSet.Open;
|
||||
except
|
||||
FListLinkTmpSetActive := False;
|
||||
Exit;
|
||||
end;
|
||||
ListFields := TList.Create;
|
||||
try
|
||||
if FListLinkTmpSetActive then
|
||||
FListLink.DataSet.Open;
|
||||
if FListLink.DataSet.Active then
|
||||
begin
|
||||
FListLink.DataSet.GetFieldList(ListFields, FListFieldName);
|
||||
|
Loading…
Reference in New Issue
Block a user