bubble sort a selection

C

Crack

is it possible to sort a selection of shapes ?
when a selection of shapes is created, how is position number( 1 ) in the
selection determined by Visio.

i.e.
activewindow.selectall
set selectObj= activewindow.selection

for I = 1 to selectObj.count
debug.print slectObj.item(i).name
next

is it then possible to reposition / manipultate the shapes within the
selectobj. ??
i.e switch selectobj.item(2) with selectobj.item(5)
 
C

Chris Roth [ Visio MVP ]

Shapes have ids that are different from item numbers, so watch out here.

For the page.Shapes collection, item numbers are from back to front,
z-order-wise.

I assume it's the same for a Selection object, unless you Shift+clicked
them, then it's probably in that order.

You might play around with Page.CreateSelection... see if you can add shapes
to your selection in the sorted order. In this way, you could take a user
selection in a Visio window, and essentially "sort-copy" it to your own
created selection.

I don't think you can shove items around in a selection that already exists.

Hopefully this gives you something to get a little further with...

--

Hope this helps,

Chris Roth
Visio MVP
 
C

Crack

is page.createselection a method only available to Vis 2003, ( I cannot
locate reference to it in the Vis 2002 object browser ) ??

My intention is to sort shapes within a selection based upon their Y
position on a page. the lower down on the page the more toward the front
etc. This would be instrumental to delivering a 3D dynamic output. I am able
to accurately "spin" 3D blocks about the page, the hurdle is determining when
block(1) is in front of block (5) during the spinning oblique view.

thank you for advice
 

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