altID
Joe Lewis Wilkins
pepetoo at cox.net
Sat May 26 14:55:23 EDT 2007
Dick,
I admire in cleverness of all this, but the code is even worse to
comprehend than assembly language. Seems to me we're going backwards.
Can't we just keep things simple; like with put and get and
meaningful names?
Seems to me we're defeating the whole purpose of Rev.
Just MHO,
Joe Wilkins
On May 26, 2007, at 11:37 AM, Dick Kriesel wrote:
> On 5/26/07 3:51 AM, "David Bovill" <david at openpartnership.net> wrote:
>
>> I like the idea of being able to copy a template
>> into a stack and still refer to the object by its altID - so
>> everything
>> keeps working. The aim is not to have to rename anything in a
>> script as this
>> gets messy in a general case.
>>
>> But if I copy 10 versions to the same stack it won't work with altIDs
>> because they would all have the same id and as (unlike the case
>> with normal
>> ids) - you cant use a syntax like "group id 65535 of card 1" there
>> is no way
>> to distinguish them without renaming them.
>
> If you make ten copies of a template, you need to distinguish each
> of the
> ten somehow. Since you'd rather not rename them "copy1" through
> "copy10"
> you can identify each copy in a custom property set of the object that
> contains them.
>
> <script>
> function copyTemplate pTemplateName,pLibraryName,pTarget
> put the uTemplateCopies of pTarget into tTemplateCopies
> put the keys of tTemplateCopies into tKeys
> filter tKeys with pTemplateName,pLibraryName,"*"
> put number of lines in tKeys + 1 into tCopyNumber
> copy group pTemplateName of stack pLibraryName to pTarget
> set the uTemplate of it to pTemplateName,pLibraryName
> set the uCopies of group pTemplateName of stack pLibraryName to \
> the long id of it
> set the uTemplateCopies of pTarget to tTemplateCopies \
> & pTemplateName,pLibraryName,tCopyNumber & cr
> return tCopyNumber
> end copyTemplate
> </script>
>
> Then each template knows its copies, each copy knows its template,
> and each
> target knows which copies of which templates it contains. Your code
> can
> refer to a control in any of the copies using an "of group id"
> clause to
> disambiguate the altIDs.
>
> <script>
> put the text of control id tAltID of group id \
> the uTemplateCopies[tTemplateName,tLibraryName,tCopyNumber] of
> tTarget
> </script>
>
> Please note that the above code is a suggestion typed into an
> email, rather
> than tested code copied from a working app. Does the suggestion
> work for
> you? If you improve the code somehow, please share your results.
>
> -- Dick
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list