On Jan 16, 2013, at 7:15 PM, Geoff Canyon wrote: > On Wed, Jan 16, 2013 at 5:49 PM, Richard Gaskin > <ambassa...@fourthworld.com>wrote: > >> FWIW, I submitted a request some time ago for a "truncated ID" option >> which uses the stack name instead of the stack path, similar to what the >> engine does when storing behavior references: >> >> <http://quality.runrev.com/**show_bug.cgi?id=7608<http://quality.runrev.com/show_bug.cgi?id=7608> >>> >> > > > This would be great. I added a comment to allow using this form of ID in > place of an object reference, the same as long ids.
Here's my workaround: getProp robustID ---- a virtual property, read only ---- -- getting the long id of a control can result in different values depending on -- (a) where the stack is stored on the user's disk and -- (b) which card is the currentcard when the property is fetched -- the robustID is consistent no matter what card is current -- and no matter which folder the user has stored the stack in; -- format: button id 1039 of bkgnd id 1003 of stack "subStack1" -- of stack "tMainStack" -- the robustID can be used as a complete object reference, -- just like the long name -- requires q() put the long id of the target into tLongID replace " stack " with cr in tLongID put line -1 of tLongID into mainStackFileName if not (word 1 of mainStackFileName = "stack") then put "stack " before mainStackFileName end if put the short name of mainStackFileName into mainStackName put q(mainStackName) into line -1 of tLongID replace cr with " stack " in tLongID replace " of " with cr in tLongID put lineoffset(cr &"card",cr & tLongID) into cdLineNbr if cdLineNbr > 1 then delete line cdLineNbr of tLongID replace cr with " of " in tLongID replace "group" with "bkgnd" in tLongID -- in case the group is not placed on the currentcard return tLongID end robustID function q str -- quote return quote & str & quote end q -- Peter Peter M. Brigham pmb...@gmail.com http://home.comcast.net/~pmbrig _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode