Custom Property Tutorial?

Richard Gaskin ambassador at fourthworld.com
Thu Mar 10 17:02:37 EST 2005


Mark Swindell wrote:
 > Is there a particularly good custom property tutorial out there
 > for "the rest of us?"  I'd like to learn to use them but haven't
 > successfully tackled them yet.

They may change your life.  Very handy, very flexible.


MINI-TUTORIAL ON CUSTOM PROPERTIES
----------------------------------

The simplest thing to know is that they work just like built-in properties:

   set the uMyProperty of btn 1 to "Hello World"
   get the uMyProperty of btn 1

Every object can have a nearly unlimited number of custom properties, 
accessed using the syntax above.

You can also have a nearly unlimited number of custom property sets. If 
you think of a property set as a rack with multiple shelves, having 
multiple custom property sets is like having multiple racks.  There's a 
default set, but you can change it to anything else:

   set the customPropertySet of btn 1 to "MySet"
   set the uMyProperty of btn 1 to "Hello World"
   set the customPropertySet to empty -- restores to default

You can use array notation to access items in the non-default custom 
property set, with the set name being outside the brackets and the 
element name within the brackets -- this is the equivalent of what I 
just wrote above:

   set the MySet[uMyProperty] of btn 1 to "Hello World"

In addition to accessing an element in a set by name, as you would if 
you labelled shelves on a rack, you can also address them with a number:

  set the MySet[4] of btn 1 to "Hello World"

These posts may be helpful:
<http://lists.runrev.com/pipermail/metacard/2003-August/005798.html>
<http://lists.runrev.com/pipermail/use-revolution/2004-May/036534.html>
<http://lists.runrev.com/pipermail/use-revolution/2002-July/006149.html>

After reading those I'd recommend opening the Dictionary and reviewing 
the entries for:

  put
  set
  customKeys
  customPropertySets
  split -- to turn a delimited string into an array
  combine -- to turn an array into a delimited string

Then set aside an hour or so to play with what you've learned.  At the 
end of that 90 minute investment if you're not a master just come on 
back with any questions and you'll master them soon enough. :)

--
  Richard Gaskin
  Fourth World Media Corporation
  __________________________________________________
  Rev tools and more: http://www.fourthworld.com/rev


More information about the use-livecode mailing list