altID

Dick Kriesel dick.kriesel at mail.com
Sat May 26 03:13:02 EDT 2007


On 5/20/07 5:35 AM, "David Bovill" <david at openpartnership.net> wrote:

> Has anyone got extensive experience of using altID? I am thinking of using
> it - but not sure exactly how.
> 
> The scenario I have is to do with a library of components that get copied
> all over the place, replace each other and need a good way of referring to
> each other and their library equivalents. I cant to use ids as they change
> when copied. I can't use names, because there may be other controls of the
> same name, and i want to be able to rename them without affecting anything,
> so... can I use altIDs?

Hi, David.  Yes, you can use altIDs, as in the following example:

<script>
on mouseUp
  create stack
  go to it
  create group "aTemplate"
  create field in it
  set altID of it to 1
  set text of it to "template"
  clone group "aTemplate"
  set name of it to "aClone"
  put "clone" into field id 1 of group "aClone"
  put field id 1 of group "aTemplate" && field id 1 of group "aClone"
end mouseUp
</script>

Watch out for using an altID that Rev uses as a primary id.  You could
create a thousand clones in one stack using the above technique without
clashing with Rev's ids.  If you need ten thousand, you can set the id of
the stack up by ten thousand, and used the skipped Rev ids for your altIDs.

Watch out also for the upper limit on altIDs, which is 65535.

Does that work for you?

-- Dick





More information about the use-livecode mailing list