Procedure for selecting into a selection box without disturbing other selection boxes on the page?

In a weldment part, I have four selection boxes on a property manager page.

The programming context is a VB.Net add-in.

The intent is to load all four boxes via the API. After the inital load, the user may click on any box to put the selection focus there, then click on an entity in the graphics area to load it into the selection box.

I have several problems.

1. When the program selects into Box 1, without touching any other box, Box 2 and Box 4 are also loaded with the same entity that was selected into Box 1. This is especially strange because Box 2 and Box 4 are filtered to receive dimensions only, and the selection in Box 1 is not a dimension.

The behaviors below occur apart from the program; at the property manager handler does not react to selections in Box 2, Box 3 or Box 4.

2. When the selection focus is on Box 2, and the user clicks on a dimension, the selected dimension appears in Box 2 and also in Box 1 (which is filtered not to accept dimensions), and also is added to Box 4, even though Box 4 is set to accept a single item only.

3. When the selection focus is on Box 3, and the user clicks on a dimension, the selected dimension appears in Box 3; Box 1 is cleared; Box 2 is cleared; the selected dimension is added to Box 4.

3. When the selection focus is on Box 4, and the user clicks on a  dimension, the selected dimension appears in all four Boxes.

Here is the code which creates the selection boxes:

'BOX 1

ReDim filters(3)
      filters(0) = swSelectType_e.swSelBODYFEATURES
      filters(1) = swSelectType_e.swSelFACES
      filters(2) = swSelectType_e.swSelSOLIDBODIES
      filters(3) = swSelectType_e.swSelSUBWELDFOLDER
      filterObj = filters
      iControlType = swPropertyManagerPageControlType_e.swControlType_Selectionbox
      sCaption = ""
      iOptions = swAddControlOptions_e.swControlOptions_Visible + swAddControlOptions_e.swControlOptions_Enabled + swAddControlOptions_e.swControlOptions_SmallGapAbove
      sTip = "Select Cutlist Item, Body (from Tree), Face, or Feature (from Tree)"
      pm_ItemSelection = pm_Page.AddControl(id_ItemSelection, iControlType, sCaption, iAlignment, iOptions, sTip)
      pm_ItemSelection.SingleEntityOnly = True
      pm_ItemSelection.AllowMultipleSelectOfSameEntity = False
      pm_ItemSelection.AllowSelectInMultipleBoxes = False
      pm_ItemSelection.Mark = id_ItemSelection
      pm_ItemSelection.Height = 16
      pm_ItemSelection.SetSelectionFilters(filterObj)

' All remaining selection boxes are for dimension only.
      ReDim filters(0)
      filters(0) = swSelectType_e.swSelDIMENSIONS
      filterObj = filters


'BOX 2

      ' Thickness selection
      iControlType = swPropertyManagerPageControlType_e.swControlType_Selectionbox
      sCaption = ""
      iOptions = swAddControlOptions_e.swControlOptions_Visible + swAddControlOptions_e.swControlOptions_Enabled + swAddControlOptions_e.swControlOptions_SmallGapAbove
      sTip = "Click on a dimension"
      pm_ThickSelection = pm_Page.AddControl(id_ThickSelection, iControlType, sCaption, iAlignment, iOptions, sTip)
      pm_ThickSelection.SingleEntityOnly = True
      pm_ThickSelection.AllowMultipleSelectOfSameEntity = False
      pm_ThickSelection.AllowSelectInMultipleBoxes = False
      pm_ThickSelection.Mark = id_ThickSelection
      pm_ThickSelection.Height = 16
      pm_ThickSelection.SetSelectionFilters(filterObj)

'BOX 3

      ' Width selection
      iControlType = swPropertyManagerPageControlType_e.swControlType_Selectionbox
      sCaption = ""
      iOptions = swAddControlOptions_e.swControlOptions_Visible + swAddControlOptions_e.swControlOptions_Enabled + swAddControlOptions_e.swControlOptions_SmallGapAbove
      sTip = "Click on a dimension"
      pm_WidthSelection = pm_Page.AddControl(id_WidthSelection, iControlType, sCaption, iAlignment, iOptions, sTip)
      pm_WidthSelection.SingleEntityOnly = True
      pm_WidthSelection.AllowMultipleSelectOfSameEntity = False
      pm_WidthSelection.AllowSelectInMultipleBoxes = False
      pm_WidthSelection.Mark = id_WidthSelection
      pm_WidthSelection.Height = 16
      pm_WidthSelection.SetSelectionFilters(filterObj)

'BOX 4

      ' Length selection
      iControlType = swPropertyManagerPageControlType_e.swControlType_Selectionbox
      sCaption = ""
      iOptions = swAddControlOptions_e.swControlOptions_Visible + swAddControlOptions_e.swControlOptions_Enabled + swAddControlOptions_e.swControlOptions_SmallGapAbove
      sTip = "Click on a dimension"
      pm_LengthSelection = pm_Page.AddControl(id_LengthSelection, iControlType, sCaption, iAlignment, iOptions, sTip)
      pm_LengthSelection.SingleEntityOnly = True
      pm_LengthSelection.AllowMultipleSelectOfSameEntity = False
      pm_LengthSelection.AllowSelectInMultipleBoxes = False
      pm_LengthSelection.Mark = id_LengthSelection
      pm_LengthSelection.Height = 16
      pm_LengthSelection.SetSelectionFilters(filterObj)

'Here is the callback for the selection boxes.

   '-----------------------------
   '-----------------------------
   Public Sub OnSelectionboxListChanged(ByVal Id As Integer, ByVal Count As Integer) Implements SolidWorks.Interop.swpublished.IPropertyManagerPage2Handler7.OnSelectionboxListChanged
      If Not nInitComplete Then
         Exit Sub
      End If

      ' Selecting to a selection box in ItemDisplayUpdate triggers a recursive callback to this procedure--ignore it.
      If nSelectionCallbackActive Then
         Exit Sub
      End If

      nSelectionCallbackActive = True
      Try
         If Count < 1 Then
            Exit Sub
         End If


         Select Case Id
            Case id_ItemSelection ' reacts to a click in Box 1 only.
               ItemFolderSelectionHandle()
               ItemDisplayUpdate()
         End Select
      Catch ex As Exception
      Finally
         nSelectionCallbackActive = False
      End Try
   End Sub

Any ideas on how to stop the weirdness?

SolidworksApi macros