Missing properties

Geoff Canyon gcanyon at gmail.com
Mon Dec 8 13:54:10 EST 2014


On Sun, Dec 7, 2014 at 7:47 AM, Geoff Canyon <gcanyon at gmail.com> wrote:

> If the object in question is inside a group, you'd have to recurse your
> way out, or you could use:
>
>     put word -5 to -1 of the long id of btn 1
>
> or if you prefer:
>
>     put word -5 to -1 of the long name of btn 1
>
> (the second would use the name of the card) for just the stack use:
>
>     put word -2 to -1 of the long id of btn 1
>

I wasn't thinking about substacks (durhh). I also didn't account for the
different number of words in a card name if the card has a name vs. just an
id. So if you want a reference to the containing stack (meaning the
substack if there is one) then you'd need:

function owningStack pID
  if word -5 of pID is "stack" then return word -5 to -1 of pID else return
word -2 to -1 of pID
end owningStack

For the card id:

function owningCardID pID
  if word -5 of pID is "stack" then return word -9 to -1 of pID else return
word -6 to -1 of pID
end owningCardID

And for the card name:

function owningCardName pID
   if word -5 of pID is "stack" then put -8 into S else put -5 into S
   if word S of pID is "id" then return word S-1 to -1 of pID else return
word S to -1 of pID
end owningCardName



More information about the use-livecode mailing list