My app allows the user to add LinkPoints to a DiagramBlock, which works fine. But I would like to be able to delete unused LinkPoints to clean things up. So, the first question is: what is the correct method to delete a LinkPoint? There seem to be only 2 options, Free and Release. These sort of work, but cause problems. Is there a preference or is some other method better?
Q2: I am using a loop to check each LinkPoint on the Block and if it's not attached to anything, delete it:
for i := ThisBlock.LinkPoints.Count-1 downto 0 do if ThisBlock.LinkPoints[i].AnchoredCount = 0 then ThisBlock.LinkPoints[i].Free;
But, depending on the sequence of used and unused LinkPoints, this may not delete all the unused LinkPoints and some of the used LinkPoints become disconnected from the lines that were anchored to them, moving the line no longer moves the anchored line end (though they still show the line as anchored). I presume that some parameters of the LinkPoints higher in the list are getting reset, but others are not.
At the moment I am just setting the unused LinkPoints visible to False, which works fine, but it seems a very inelegant method.
Is there something I am missing or a better way to do this sort of thing?