mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-12 09:39: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 LinkGetBookMark;
|
||||||
procedure LinkGotoBookMark;
|
procedure LinkGotoBookMark;
|
||||||
procedure SetKeyFieldName(const Value: string);
|
procedure SetKeyFieldName(const Value: string);
|
||||||
|
procedure SetListFieldName(const Value: string);
|
||||||
procedure SetListSource(Value: TDataSource);
|
procedure SetListSource(Value: TDataSource);
|
||||||
procedure SetLookupCache(const Value: boolean);
|
procedure SetLookupCache(const Value: boolean);
|
||||||
protected
|
protected
|
||||||
@ -166,7 +167,7 @@ Type
|
|||||||
// properties to be published by owner control
|
// properties to be published by owner control
|
||||||
// these are not used where data control Field is dbLookup
|
// these are not used where data control Field is dbLookup
|
||||||
property KeyField: string read GetKeyFieldName write SetKeyFieldName;
|
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 ListFieldIndex: Integer read FListFieldIndex write FListFieldIndex default 0;
|
||||||
property ListSource: TDataSource read GetListSource write SetListSource;
|
property ListSource: TDataSource read GetListSource write SetListSource;
|
||||||
end;
|
end;
|
||||||
|
@ -122,6 +122,12 @@ begin
|
|||||||
FKeyFieldNames := Value;
|
FKeyFieldNames := Value;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TDBLookup.SetListFieldName(const Value: string);
|
||||||
|
begin
|
||||||
|
FListFieldName := Value;
|
||||||
|
FListLink.FieldName := Value;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TDBLookup.SetListSource(Value: TDataSource);
|
procedure TDBLookup.SetListSource(Value: TDataSource);
|
||||||
begin
|
begin
|
||||||
if FListSource = Value then
|
if FListSource = Value then
|
||||||
@ -249,11 +255,16 @@ begin
|
|||||||
|
|
||||||
if (FKeyFieldNames > '') and Assigned(FListLink.Dataset) then
|
if (FKeyFieldNames > '') and Assigned(FListLink.Dataset) then
|
||||||
begin
|
begin
|
||||||
ListFields := TList.Create;
|
|
||||||
FListLinkTmpSetActive := not FListLink.DataSet.Active;
|
FListLinkTmpSetActive := not FListLink.DataSet.Active;
|
||||||
|
if FListLinkTmpSetActive then
|
||||||
|
try
|
||||||
|
FListLink.DataSet.Open;
|
||||||
|
except
|
||||||
|
FListLinkTmpSetActive := False;
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
ListFields := TList.Create;
|
||||||
try
|
try
|
||||||
if FListLinkTmpSetActive then
|
|
||||||
FListLink.DataSet.Open;
|
|
||||||
if FListLink.DataSet.Active then
|
if FListLink.DataSet.Active then
|
||||||
begin
|
begin
|
||||||
FListLink.DataSet.GetFieldList(ListFields, FListFieldName);
|
FListLink.DataSet.GetFieldList(ListFields, FListFieldName);
|
||||||
|
Loading…
Reference in New Issue
Block a user