By Eric Sweet - Friday, August 20, 2010
Hi,
I'm working on enabling users to select all shapes that have child shapes, in an organization chart. So basically, all the manager shapes. I need to be able to iterate through the shapes and select only the parents.
I tried the code below but for some reason the doc.ActiveLayer.Children(NFilters.Shape2D) never returns any shapes. I use similar code (from your example app) to add expand/collapse decorators and it works fine. That code is not in a sub being called from a button however, it's in the load event. Would that matter?
Public Sub SelectSumTasks(ByVal doc As NDrawingDocument, ByVal view As NDrawingView) Dim selection As NSelection = View.Selection ' select all summary task shapes so user can edit as a group For Each shape As NShape In doc.ActiveLayer.Children(NFilters.Shape2D) If shape.GetOutgoingShapes().Count = 0 Then Continue For End If
' create the decorators collection 'shape.CreateShapeElements(ShapeElementsMask.Decorators) selection.MultiSelect(shape)
Next shape End Sub
Thanks for any help, Eric
|
By Nevron Support - Friday, August 20, 2010
Hi Eric, are the shapes already added to the document when you call your method ?
|
By Eric Sweet - Friday, August 20, 2010
They are. I've used your sample code to add a button to the interface, so I'm calling the sub as the handler for the button click.
|
By Nevron Support - Friday, August 20, 2010
Ok, please, send you sample project to our support email support@nevron.com, and we'll be able to assist you better.
|
By Eric Sweet - Monday, August 23, 2010
Hi,
Thanks for the offer, but in the end I worked it out. The problem was just that I was using an MDI form, so I had to change the way I interacted with the document and view.
Thanks again, Eric
|
|