Function to break apart a Long Name?

Jeanne A. E. DeVoto revolution at jaedworks.com
Thu Oct 20 20:18:58 EDT 2005


At 10:59 PM -0400 10/18/2005, Cubist at aol.com wrote:
>sez revolution at jaedworks.com:
>>At 4:00 PM +0100 10/17/2005, David Burgun wrote:
>>>Does anyone know of a function that will extract name of the
>>>Control, Group, Card and Stack from a long name string?
>>>e.g. I have a string of the form:
>  >>control "A" of group "B" of card "C" of stack "D"
>  >I'd use the short name in conjunction with the owner for this:
>>
>>    -- "myControl" is control "A" of group "B" of card "C" of stack "D"
>>    put the short name of myControl into myControlName
>>    put the short name of the owner of myControl into myGroupName
>>    put the short name of the owner of the owner of myControl into myCardName
>>    put the short name of the owner of the owner of the owner of
>>myControl into myStackName
>    Problem: If you use this on something that *isn't* in a group, myGroupName
>will end up being the name of a card; myCardName will be the stack name; and
>I'm not sure *what* myStackName will end up as.

The problem as stated had a string in a particular form, which 
included a group. To generalize this solution obviously would take 
more code than this. (You'd need to check word 1 of the long name of 
"myControl", of "the owner of myControl", etc. If you want to be 
thorough, you also need to check the hcAddressing property.)

I suppose I just wanted to answer the question, rather than write out 
a general solution which would be both more complicated and not 
needed in this case.
-- 
jeanne a. e. devoto ~ revolution at jaedworks.com
http://www.jaedworks.com



More information about the use-livecode mailing list