mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-04 07:42:59 +02:00
IdeIntf: propedits: fix call stored method with index parameter if needed. Issue #31923
git-svn-id: trunk@55098 -
This commit is contained in:
parent
626736e5e2
commit
a08eb48d76
@ -2554,10 +2554,12 @@ end;
|
|||||||
|
|
||||||
type
|
type
|
||||||
TBoolFunc = function: Boolean of object;
|
TBoolFunc = function: Boolean of object;
|
||||||
|
TBoolIndexFunc = function(const Index: Integer): Boolean of object;
|
||||||
function TPropertyEditor.CallStoredFunction: Boolean;
|
function TPropertyEditor.CallStoredFunction: Boolean;
|
||||||
var
|
var
|
||||||
Func: TMethod;
|
Met: TMethod;
|
||||||
FFunc: TBoolFunc;
|
Func: TBoolFunc;
|
||||||
|
IndexFunc: TBoolIndexFunc;
|
||||||
APropInfo: PPropInfo;
|
APropInfo: PPropInfo;
|
||||||
StoredProcType: Byte;
|
StoredProcType: Byte;
|
||||||
begin
|
begin
|
||||||
@ -2566,14 +2568,21 @@ begin
|
|||||||
if StoredProcType in [ptStatic, ptVirtual] then
|
if StoredProcType in [ptStatic, ptVirtual] then
|
||||||
begin
|
begin
|
||||||
case StoredProcType of
|
case StoredProcType of
|
||||||
ptStatic: Func.Code := APropInfo^.StoredProc;
|
ptStatic: Met.Code := APropInfo^.StoredProc;
|
||||||
ptVirtual: Func.Code := PPointer(Pointer(FPropList^[0].Instance.ClassType))[{%H-}PtrInt(APropInfo^.StoredProc) div SizeOf(Pointer)];
|
ptVirtual: Met.Code := PPointer(Pointer(FPropList^[0].Instance.ClassType))[{%H-}PtrInt(APropInfo^.StoredProc) div SizeOf(Pointer)];
|
||||||
end;
|
end;
|
||||||
if Func.Code = nil then
|
if Met.Code = nil then
|
||||||
raise EPropertyError.Create('No property stored method available');
|
raise EPropertyError.Create('No property stored method available');
|
||||||
Func.Data := FPropList^[0].Instance;
|
Met.Data := FPropList^[0].Instance;
|
||||||
FFunc := TBoolFunc(Func);
|
if ((APropInfo^.PropProcs shr 6) and 1) <> 0 then // has index property
|
||||||
Result := FFunc();
|
begin
|
||||||
|
IndexFunc := TBoolIndexFunc(Met);
|
||||||
|
Result := IndexFunc(APropInfo^.Index);
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
Func := TBoolFunc(Met);
|
||||||
|
Result := Func();
|
||||||
|
end;
|
||||||
end else
|
end else
|
||||||
if StoredProcType = ptConst then
|
if StoredProcType = ptConst then
|
||||||
Result := APropInfo^.StoredProc<>nil
|
Result := APropInfo^.StoredProc<>nil
|
||||||
|
Loading…
Reference in New Issue
Block a user