The API Help shows ‘SelectionChanged’ associated only with ‘ToolControlBase’, ‘CommandBarComboBox’ and ‘ReferenceComboBox’ but states that the ‘GraphicPicker.GraphicPick’ event … “occurs when the user picks an object in a graphic view”, which I think is what I want.
I have converted the C# example from your link to VB, but after much experimenting I still have not managed to write a working handler and link it to my required event.
I would be very grateful if someone would give a detailed example of how to do this in VB.
OK, I sorted it. For the benefit of anyone else who is struggling with event handlers in VB, here is an example which displays a message box whenever a face or body are selected.
Add a reference to ‘ABB.Robotics.RobotStudio.Stations.Forms’ in the form or module properties then include this line at the start of the form/module code:
Imports ABB.Robotics.RobotStudio.Stations.Forms
Add this code so that it executes before a graphic selection will be made:
Public Sub MySub_SelectionChanged(ByVal sender As Object, ByVal e As GraphicPickEventArgs)
If e.PickedObject IsNot Nothing Then
If e.PickedObject.TypeDisplayName = "Face" Then
MsgBox("Face selected")
ElseIf e.PickedObject.TypeDisplayName = "Body" Then
MsgBox("Body selected")
End If
End If
End Sub