Missing properties
Scott Rossi
scott at tactilemedia.com
Mon Dec 8 17:33:11 EST 2014
I haven’t been following this thread closely but the goal is to get the id and/or name of the card on which a controls sits, yes?
If so, wouldn’t the following 2 functions work?
# pObj is a long id control reference
function cardOwnerID pObj
set the wholeMatches to true
return char offset("card id",pObj) to -1 of pObj
end cardOwnerID
function cardOwnerName pObj
return short name of cardOwnerID(pObj)
end cardOwnerName
Admittedly, the cardOwnerID function could fail if a control was located within a nested group that was explicitly named “card id” but. . .
Regards,
Scott Rossi
Creative Director
Tactile Media, UX/UI Design
On Dec 8, 2014, at 10:54 AM, Geoff Canyon <gcanyon at gmail.com> wrote:
> 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
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list