Author Topic: Glued to Method has errors  (Read 782 times)

0 Members and 1 Guest are viewing this topic.

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3794
  • Ideas Visio-lized into solutions
Glued to Method has errors
« on: September 08, 2019, 08:50:34 PM »
I don't think this is unique to V2019, but it is what I'm using.  This is simple test.  Just a few shapes on a page with some connectors.  Simple macro.  I'm only interested in shapes connected to the connectors.  Not interested in the case of which connectors are glued to a shape.  The code runs, lists a connector and then lists the incoming and outgoing shapes connected to it.  Pretty simle indeed.  However, I found a couple of cases, which ought to be legitimate connectivity scenarios where the gluedto method gets it wrong.

Don't think I missed any thing.  Let me know.
Visio 2019 Pro

Yacine

  • Hero Member
  • *****
  • Posts: 2697
Re: Glued to Method has errors
« Reply #1 on: September 09, 2019, 01:17:47 AM »
Can't see the error.
Here's the output on my machine:
Code
Dynamic connector
Incoming 2D shapes
Sheet.1
Outgoing 2D shapes
Sheet.2


Dynamic connector.5
Incoming 2D shapes
Sheet.2
Outgoing 2D shapes
Sheet.4



Dynamic connector.8
Incoming 2D shapes
Sheet.6
Outgoing 2D shapes
Sheet.7


Dynamic connector.11
Incoming 2D shapes
Sheet.9
Outgoing 2D shapes
Sheet.7
Yacine

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3794
  • Ideas Visio-lized into solutions
Re: Glued to Method has errors
« Reply #2 on: September 09, 2019, 08:27:08 AM »
Oops.  Should have also said...1st two pages work as expected, they're Good1 and Good2.  Second set of pages, Err1 and Err2, have reporting errors.  It's always at the end of the listings as I recall.  Will upload examples when I'm at my computer.
Visio 2019 Pro

Yacine

  • Hero Member
  • *****
  • Posts: 2697
Re: Glued to Method has errors
« Reply #3 on: September 09, 2019, 09:40:31 AM »
The error is in the way you address the shapes. Use ...shapes.ItemFromID(..) instead of the direct assignment shapes(..).
Explanation: On the first page the index corresponds to the ID, after duplicating it's different ? ? ? ? No real clue.
« Last Edit: September 09, 2019, 11:46:09 AM by Yacine »
Yacine

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3794
  • Ideas Visio-lized into solutions
Re: Glued to Method has errors
« Reply #4 on: September 09, 2019, 10:33:11 AM »
Hmmm.  As I look closer, yes, some of the indexing looks like it is wrong.  For example, Error2 page has a shape, Sheet.10, and a connector, Dyn Conn.10.  That's not right.  Will create same connectivity, but, without the indexing errors.  Very strange why those are there.  Didn't think THAT was possible.  So, perhaps a BUG, just not the one I thought!!!

The Good1 page was first page populated.  The 2nd page, was Error1.  It was populated using copy All / paste.  Then edited.  Similarly with 3rd page which was Error2.  Finally, Good4, done same way, was the 4th page.

As for code, it's straight from M$.

Will try with corrected indexing.
Thanks for the idea.  Certainly worth exploring.
« Last Edit: September 09, 2019, 10:43:23 AM by wapperdude »
Visio 2019 Pro

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3794
  • Ideas Visio-lized into solutions
Re: Glued to Method has errors
« Reply #5 on: September 09, 2019, 11:07:31 AM »
Indeed it was bad indexing.

What's weird, the indexing error occurs when do select all, copy, and then paste to new page.  Don't ever remember seeing that in V2007.

Thanks Yacine.

Oh, there is still a bug in the Glue to Method.  If you connect a connector to the middle of another connector (glued, not just snapped), it doesn't know what to do.  See last page of updated file. Somewhat reasonable...is the glued connector an incoming or outgoing shape.  Well, depends upon which end has been glued.  The method   doesn't seem to handle that.

Well, instead of one bug, there's two bugs. 

Can anyone verify the copy/paste bug with other versions of Visio.  Be nice to know when it appeared, or if it's unique to my instantiation of Visio.
« Last Edit: September 09, 2019, 11:09:33 AM by wapperdude »
Visio 2019 Pro

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3794
  • Ideas Visio-lized into solutions
Re: Glued to Method has errors
« Reply #6 on: September 09, 2019, 02:14:50 PM »
Well.  Found solution for connector connector combination.  Almost.  It catches incoming and outgoing, but doesn't always get the directionality correct. 

The key, was as Yacine suggested, change the syntax.
Was:  ActivePage.Shapes(shpIDs(i)).Name
Becomes:  ActivePage.Shapes.ItemFromID(shpIDs(i)).Name

See attached file...
Visio 2019 Pro