10087 : Links in phGantTimePackage


I add 4 Ganttimes with links.
OK  !

But …
1. How can I remove one link
2. How can I remove all links
( I mean only the links – not remove time and add time again)

3. How can I link again (without ADDTIME – only the links)


You can addlinks like this:

    phGantXControl.IphDataEntity_Link mylink;
    mylink.StartFinishOption=(phGantXControl.TxLinkStartFinishOption) oneoffive;

You can remove links by getting the list of all links: IphGantX3.GetLinks, this gives you an IphDataList2 that you can iterate and do all normal list actions with, like remove or Clear to remove all links…

If you put some external reference in your IphDataEntity_GantTime.UserReference, you might also consider to put a UserReference in the IphDataEntity_Link.UserReference. In that case you can find a link by IphGantX3.GetLinks.FindFromUserReference.

If you simply iterate the IphGantX3.GetLinks you can check if a link is connected to the currently selected GantTime with this code;

for i=0 to IphGantX3.GetLinks-Count-1 do
  dim alink as IphDataEntity_Link
  set alink=IphGantX3.GetLinks[i]
  if ((not alink.LinkOwner is Null) and (not alink.LinkedTo is Null) then
    if (alink.LinkOwner=Gantt1.IphGantX3.ActiveDataEntity) or (alink.LinkedTo=Gantt1.IphGantX3.ActiveDataEntity) then
      ‘ Found one, do stuff…
Next i

Leave a Reply