Ideintf: check parent row interface when checking if TInterfacePropertyEditor is expandable

This commit is contained in:
Marc 2021-09-27 20:06:40 +02:00
parent 907f82485b
commit f67149d196

View File

@ -1474,7 +1474,7 @@ begin
while (s<=length(PropPath)) do begin while (s<=length(PropPath)) do begin
e:=s; e:=s;
while (e<=length(PropPath)) and (PropPath[e]<>'.') do inc(e); while (e<=length(PropPath)) and (PropPath[e]<>'.') do inc(e);
CurName:=copy(PropPath,s,e-s); CurName:=uppercase(copy(PropPath,s,e-s));
s:=e+1; s:=e+1;
// search name in children // search name in children
if CurParentRow=nil then if CurParentRow=nil then
@ -2209,6 +2209,7 @@ end;
function TOICustomPropertyGrid.CanExpandRow(Row: TOIPropertyGridRow): boolean; function TOICustomPropertyGrid.CanExpandRow(Row: TOIPropertyGridRow): boolean;
var var
AnObject: TPersistent; AnObject: TPersistent;
AnInterface: IInterface;
ParentRow: TOIPropertyGridRow; ParentRow: TOIPropertyGridRow;
begin begin
Result:=false; Result:=false;
@ -2216,17 +2217,28 @@ begin
if (not (paSubProperties in Row.Editor.GetAttributes)) then exit; if (not (paSubProperties in Row.Editor.GetAttributes)) then exit;
// check if circling // check if circling
if (Row.Editor is TPersistentPropertyEditor) then begin if (Row.Editor is TPersistentPropertyEditor) then begin
if (Row.Editor is TInterfacePropertyEditor) then if (Row.Editor is TInterfacePropertyEditor) then begin
AnObject:={%H-}TPersistent(Row.Editor.GetIntfValue) AnInterface:=Row.Editor.GetIntfValue;
else
ParentRow:=Row.Parent;
while ParentRow<>nil do begin
if (ParentRow.Editor is TInterfacePropertyEditor)
and (ParentRow.Editor.GetIntfValue=AnInterface) then
exit;
ParentRow:=ParentRow.Parent;
end;
end
else begin
AnObject:=TPersistent(Row.Editor.GetObjectValue); AnObject:=TPersistent(Row.Editor.GetObjectValue);
if FSelection.IndexOf(AnObject)>=0 then exit; if FSelection.IndexOf(AnObject)>=0 then exit;
ParentRow:=Row.Parent;
while ParentRow<>nil do begin ParentRow:=Row.Parent;
if (ParentRow.Editor is TPersistentPropertyEditor) while ParentRow<>nil do begin
and (ParentRow.Editor.GetObjectValue=AnObject) then if (ParentRow.Editor is TPersistentPropertyEditor)
exit; and (ParentRow.Editor.GetObjectValue=AnObject) then
ParentRow:=ParentRow.Parent; exit;
ParentRow:=ParentRow.Parent;
end;
end; end;
end; end;
Result:=true; Result:=true;