Using CreateSelection from a Shape object (Visio 2003)

A

Andy Hough

Hi all,

I'm having some difficulty using the CreateSelection method of the
shape object.

I am assuming that this should create a selection object the same shape
as the parent shape, but when I look at the shapes in the selection
object taken from the result of this method I'm getting all of the
shapes on the page.

What I want to achieve is a container shape (not a group) that I can
get a list of enclosed shapes, catching this when the container shape
is dropped or resized, moved etc. I can catch the drop and resize/move
in the events no problem it's just the selection.

The code I am using is (VB.Net)

Dim sel As Visio.Selection
Dim shp As Visio.Shape
sel = theShape.CreateSelection(Visio.VisSelectionTypes.visSelTypeAll)
For Each shp In sel
MsgBox(shp.NameU)
Next

Many thanks for any help received

Andy Hough
 
A

Andy Hough

Andy said:
Hi all,

I'm having some difficulty using the CreateSelection method of the
shape object.

I am assuming that this should create a selection object the same
shape as the parent shape, but when I look at the shapes in the
selection object taken from the result of this method I'm getting all
of the shapes on the page.

What I want to achieve is a container shape (not a group) that I can
get a list of enclosed shapes, catching this when the container shape
is dropped or resized, moved etc. I can catch the drop and resize/move
in the events no problem it's just the selection.

The code I am using is (VB.Net)

Dim sel As Visio.Selection
Dim shp As Visio.Shape
sel = theShape.CreateSelection(Visio.VisSelectionTypes.visSelTypeAll)
For Each shp In sel
MsgBox(shp.NameU)
Next

Many thanks for any help received

Andy Hough

OK got this sorted - by using the SpatialNeighbors property, my code is
now

sel =
visCell.Shape.SpatialNeighbors(CShort(Visio.VisSpatialRelationCodes.visS
patialContain), 0, 0)

This now correctly returns a selection object with the right shapes.

I'm curious though why the CreateSelection doesn't work though......
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top