10648 : How can you add a link from one time object to another on double click.

Question

How can you add a link from one time object to another on double click.

I have tried using the code

Set alink = theGant.AddLink
If Not (theDataEntity Is Nothing) Then

   If alink.LinkOwner Is Nothing Then
    alink.LinkOwner = theDataEntity
  Else
    Set alink = phGantX1.AddLink
    alink.LinkedTo = theDataEntity 
  End If
End If

Answer

A link needs two time items. If you want to add a link as a result of a double click you will have one time item for sure. Namely the time item you double clicked on. But what about the other?

You can iterate thru the time items and find another selected time item (IphDataEntity_GantTime.Selected=true) or you can take the double click as the start for finding the other, by setting the component into a “link creating mode” and drag a link out to a new time item as described in this article.

The important thing to remember is to set two different time items in the link properties LinkOwner and LinkedTo, otherwise the link will not be drawn.

    Dim aLink As IphDataEntity_Link
    Set aLink = theGant.AddLink
   
    aLink.LinkOwner = theStartDataEntity
    aLink.LinkedTo = theTargetDataEntity

 

 

 

 

Leave a Reply