event AllowLink (StartItem as HITEM, StartBarKey as Variant, EndItem as HITEM, EndBarKey as Variant, LinkKey as Variant, Cancel as Boolean)
Notifies at runtime when a link between two bars is possible.

 TypeDescription 
   StartItem as HITEM A Long expression that specifies the handle of the item that hosts the bar where the link starts.  
   StartBarKey as Variant A VARIANT expression that specifies the key of the bar where the link starts.  
   EndItem as HITEM A Long expression that specifies the handle of the item that hosts the bar where the link ends.  
   EndBarKey as Variant A VARIANT expression that specifies the key of the bar where the link ends.  
   LinkKey as Variant A String expression that specifies the next available key for the link. Use the LinkKey parameter to change the default key for the newly added link at runtime.  
   Cancel as Boolean A Boolean expression that specifies whether the operation can continue. By default, the Cancel parameter is False. If The Cancel parameter is True, the specified two bars can not be linked, so the link operation is cancelled.  
The AllowLink event occurs when the user links two bars. You can disable or enable linking two bars using the AllowLink event. For instance, you can call Cancel parameter on True, anytime you need to cancel linking two specified bars. 

At runtime, you can control linking two bars using one of the followings:

The following VB sample disable linking bars to any "Summary" bars:

Private Sub G2antt1_AllowLink(ByVal StartItem As EXG2ANTTLibCtl.HITEM, ByVal StartBarKey As Variant, ByVal EndItem As EXG2ANTTLibCtl.HITEM, ByVal EndBarKey As Variant, LinkKey As Variant, Cancel As Boolean)
    With G2antt1.Items
        If (.ItemBar(StartItem, StartBarKey, exBarName) = "Summary") Then
            Cancel = True
        Else
            If (.ItemBar(EndItem, EndBarKey, exBarName) = "Summary") Then
                Cancel = True
            End If
        End If
    End With
End Sub

Use the AddLink method  to create a link between two bars. Use the Link property to access properties of a specified link. The Link(exLinksCount) property retrieves the number of links within the chart.


Send comments on this topic.
© 1999-2012 Exontrol.COM, Software. All rights reserved.