Access prop on drop

K

Kennard

Problem:A page has several instances of master "A", each has a unique custom
prop.
An instance of master "B" is dropped on an instance of master "A".
How can master "B" access the custome prop of master "A" only when A is
physically within the outline of B?
 
C

Chris [Visio MVP]

Check in the Developer Reference (comes with Visio) for the method:
SpatialNeighbors.You'll be looking for the SpatialResults of Contains or
Contained.

The general flow will be like this:

- Detect dropped shape (shpDrop)
- Ask for spatial neighbors of shpDrop
- Check neighbors to see if any of them completely contain shpDrop (result
of method SpatialNeighbors)
- Check containing shapes for whatever you need to do (ie: If Not(Master is
Nothing) then "see if master is interesting, then do stuff")
- Set properties of A to B or whatever
 
K

Kennard

Thanks Chris, I'll give this a shot.
It sounds like just what I need.
I'll share the results.

Kennard
 
K

Kennard

Chris,

I'm running Visio Pro 2003 SP2.
I'm unable to find anything related to "SpatialNeighbors" in the Developer
section.
Can you help point me to the correct area?

Thanks
 
A

Al Edlund

this from the automation reference
SpatialNeighbors property
See AlsoApplies ToExampleSpecifics

Returns a Selection object that represents the shapes that meet certain
criteria in relation to a specified shape.

objRet = object.SpatialNeighbors(Relation, Tolerance, Flags, [ResultRoot])

objRet A Selection object.

object Required. An expression that returns a Shape object.

Relation Required Integer. An integer describing the type of
relationship to be used.

Tolerance Required Double. A distance in internal drawing units with
respect to the coordinate space defined by the parent shape.

Flags Required Integer. Flags that influence the type of entries
returned in results.

ResultRoot Optional Variant. A Shape object that represents a page or
group.



Version added
2000

Remarks
For values of the Relation argument, see the SpatialRelation property.

The Flags argument can be any combination of the values of the constants
defined in the following table. These constants are also defined in
VisSpatialRelationFlags in the Visio type library.



al
 
K

Kennard

Got it now ;-)
Thanks Al

Al Edlund said:
this from the automation reference
SpatialNeighbors property
See AlsoApplies ToExampleSpecifics

Returns a Selection object that represents the shapes that meet certain
criteria in relation to a specified shape.

objRet = object.SpatialNeighbors(Relation, Tolerance, Flags, [ResultRoot])

objRet A Selection object.

object Required. An expression that returns a Shape object.

Relation Required Integer. An integer describing the type of
relationship to be used.

Tolerance Required Double. A distance in internal drawing units with
respect to the coordinate space defined by the parent shape.

Flags Required Integer. Flags that influence the type of entries
returned in results.

ResultRoot Optional Variant. A Shape object that represents a page or
group.



Version added
2000

Remarks
For values of the Relation argument, see the SpatialRelation property.

The Flags argument can be any combination of the values of the constants
defined in the following table. These constants are also defined in
VisSpatialRelationFlags in the Visio type library.



al

Kennard said:
Chris,

I'm running Visio Pro 2003 SP2.
I'm unable to find anything related to "SpatialNeighbors" in the Developer
section.
Can you help point me to the correct area?

Thanks
 

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