method Chart.RemoveSelection ()
Removes the chart objects in the selection.

 TypeDescription 
Use the RemoveSelection method to remove the objects ( bars, links ) in the chart's selection. For instance, call the RemoveSelection method when the user presses the Delete key.  The AllowSelectObjects property allows users to select at runtime the bars and links in the chart area. Use the ItemBar(exBarSelected) property to select or unselect programmatically a bar. Use the Link(exLinkSelected) property to select or unselect programmatically a link. The RemoveSelection method calls the RemoveBar to remove a bar from the selection, or RemoveLink method to remove a link from the selection. Call the AllowSelectObjects property to empty the selection, as  AllowSelectObjects = AllowSelectObjects. The SelectedObjects property returns the bars/links selected in the chart section of the control.

The following VB sample removes the selected links only:

With G2antt1
    .BeginUpdate
    With .Items
        For Each l In .SelectedObjects(exSelectLinksOnly)
            G2antt1.Template = "Items.RemoveLink(" & l & ")"
        Next
    End With
    .EndUpdate
End With

The following VB sample removes the selected bars only:

With G2antt1
    .BeginUpdate
    With .Items
        For Each b In .SelectedObjects(exSelectBarsOnly)
            G2antt1.Template = "Items.RemoveBar(" & b & ")"
        Next
    End With
    .EndUpdate
End With

When a bar is removed, any link related to it will be removed.


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