Visio Guy

Visio Discussions => Programming & Code => Topic started by: Visisthebest on September 20, 2020, 11:01:12 AM

Title: Can we count on Shape ID stability?
Post by: Visisthebest on September 20, 2020, 11:01:12 AM
Are there edge cases where the same shape on the same page will get a new Shape ID, maybe for instance there is some edge case when the user saves the file with the page over a period of weeks as new file versions, or his/her laptop crashes and he/she uses office file recovery to save the recovered file and continues working on it. Or any other edge case.

Of course if a user deletes then creates new shapes those new shapes may get the deleted shape's ID. The core question is: other than this specific scenario of shape deletion (or programmatic/otherwise intended explicit changing of the shape ID), is it virtually impossible for a Shape's ID on the same page to change?

We can use the UniqueID as well of course, but still important to understand how 'stable' Shape ID on the same page is.
Title: Re: Can we count on Shape ID stability?
Post by: Paul Herber on September 20, 2020, 04:03:30 PM
As far as I know once an ID has been issued to a shape then it is never reused, even after that shape has been deleted. The only case I can see where an ID gets reused is where a shape is deleted, then that action is undone. That restores the shape(s) with the same ID(s).
Title: Re: Can we count on Shape ID stability?
Post by: vojo on September 20, 2020, 09:22:19 PM
I guess that bug got fixed along the way.   At least at 2003, the shape ID could be reused. though I have never seen it.
There are words around SETF and GETREF about this

Essentially, the formulas
SETF(GETREF(<some cell in some shape>), <value or formula resulting in a value to go in that cell>)
and
SETF(<some cell in some shape>, <value or forumal resulting in a value to go in that cell>)
are the same, except the GETREF enforces name resolution.

This must have been fixed in post 2003.
Title: Re: Can we count on Shape ID stability?
Post by: Visisthebest on September 21, 2020, 10:12:27 AM
Thank you Paul and vojo very good to understand this better!