How to successfully assign nil to the property Lastchild below?
I try to assign 'nil' for instance to the fields fParent,fPrevSibling and fNextSibling by
----VirtualTree.Types-----
property PrevSibling: PVirtualNode read fPrevSibling {Maths added: write }write fPrevSibling;
property NextSibling: PVirtualNode read fNextSibling {Maths added: write }write fNextSibling;
property LastChild: PVirtualNode read fLastChild {Maths added: write }write fLastChild;
The 'write' is added by me to succeed with assigning, but I get this error
MyCode:
procedure TfrmMonitor.DeleteChildren(aNode: PVirtualNode; aUpdateAlgos: Boolean = True);
var
Run: PVirtualNode;
Mark: PVirtualNode;
begin
if Assigned(aNode) and (aNode.ChildCount > 0) then //has child
begin
Run := aNode.LastChild;
while Assigned(Run) do //last child
begin
Mark := Run; //mark is last child
Run := Run.PrevSibling; //run is first sibling
if Assigned(Run) then
Run.NextSibling := nil; // Error cant assign to read only property
DeleteNode(Mark, aUpdateAlgos);
end;
aNode.FirstChild := nil;
aNode.LastChild := nil; // Error cant assign to read only property
end;
end;