Article | 70002069 |
Type | HowTo |
Product | Engine |
Version | 8 |
Date Added | 9/27/2021 12:00:00 AM |
Fixed | 9.9003.0.1 (9/27/2021 12:00:00 AM) |
Submitted by | Petr Slavata |
Summary
I would like to have selection functionality that combines getUserEntity function and getUserStartWindowSelection function: user click on entity – selection set with one entity is returned and my code continue – like in getUserEntity function user click on nothing (on empty space) – window selection starts from clicked point and selection set is returned like in getUserStartWindowSelection user right click or press Esc – cancel function
Solution
Try a code like:
vdSelection MySelection = new vdSelection("test"); MySelection.SetUnRegisterDocument(doc); doc.Selections.AddItem(MySelection); MySelection.RemoveAll(); gPoint userPt = new gPoint(); vdFigure MyFig; VectorDraw.Actions.StatusCode result = doc.ActionUtility.getUserEntityOneClick(out MyFig, out userPt, vdDocument.LockLayerMethodEnum.EnableAll, true); if (result == VectorDraw.Actions.StatusCode.Success) // user didn't canceled { if (MyFig != null) // user clicked an object { MessageBox.Show("clicked: " + MyFig.ToString()); } else { VectorDraw.Actions.StatusCode resWindowSelection = doc.ActionUtility.getUserStartWindowSelection(userPt, out MySelection); if (resWindowSelection == VectorDraw.Actions.StatusCode.Success) // user didn't canceled { MessageBox.Show("selected :" + MySelection.Count.ToString() + " objects"); } } }