Issues with SelectExt()

Discuss and ask questions about CAD .NET library.

Moderators: admin, support, SDS

Post Reply
Posts: 22
Joined: 06 Jul 2018, 10:52

Issues with SelectExt()

Post by StefanChrist » 04 Dec 2018, 16:02

Hello Support,

after updating form v11 to v12 I am still facing several issues, most of them in relation with selections. We are using the SelectExt() function which should return the selected entity at a given point. Similar to MultipleSelect (viewtopic.php?f=15&t=10077) this function does not return the entity.

Setting CADSelector.UseShiftToAddSelected = True will return the entity, but will also allow multiple selection which is not desired. Using Select() instead of SelectExt() returns true, shouldn't both functions do the same?

Thanks in advance!

Posts: 22
Joined: 06 Jul 2018, 10:52

Re: Issues with SelectExt()

Post by StefanChrist » 04 Dec 2018, 18:15

I have done further investigation on this issue.

There is a param called clearPrevSelected (bool)

In v11: Setting the value to true will unselected other entities and select the new one
In v12: Setting the value to true will not unselect any entities except you select an entity that is already selected. If you want to select a non selected entity this function will return null.

Why is the param still called clearPrevSelected but won't behave like in the previous version? This param now determines if I want to select or unselect the entity, instead of unselecting other entities.

One additional question: What is the preferred way to remove the selection of entities? Atm we want to clear all selections, but clearing the list of selected entities will not update the drawing. ClearSelection() will remove the selection (and remove the entities rom the collection) but the markers still remain, so we also use ClearMarkers(). But this doesn't feel right. And this also will not work if we just want to remove on entity from the list.

Posts: 2832
Joined: 30 Mar 2005, 11:36

Re: Issues with SelectExt()

Post by support » 05 Dec 2018, 18:55

Hello Stefan,

In v12 the CADSelector.SelectExt() method behaviour depends on a CADSelector.UseShiftToAddSelected property value as described here. The third parameter of the method (clearPrevSelection) actually takes the Shift key state (pressed and held or not pressed).

In case multiple selection is not desired, you should do the following:
  • Set CADSelector.UseShiftToAddSelected = True, so that the user will have to hold the Shift key pressed to be able to add new objects to the selection set.
  • Suppress the usage of the Shift key in the SelectExt() method by setting the clearPrevSelection value to False:

Code: Select all

Me.cadImage.SelectExt(e.X, e.Y, False, True)
To clear the SelectedEntities and Markers collections with a single call, use a CADImage.Selector.UndoSelect() method.

Technical Support E-mail:
Chat support on Skype:

Post Reply