A Got-Ya

Peter M. Brigham pmbrig at gmail.com
Fri Jan 23 10:25:45 EST 2015

On Jan 20, 2015, at 9:14 PM, Geoff Canyon wrote:

> 2. It's a feature that custom property names can be stored/referenced using
> variables. For example:
>   repeat for each item P in "left,top"
>      -- not custom properties, but the same principle applies
>        set the P of button "example" to 10 * trunc(the P of button
> "example" / 10)
>   end repeat

A little late to this thread, but I couldn't resist generalizing this really nifty idea:

on initializeCprops propList,tObjRef,tDelim
   -- initialize a list of custom properties in one swoop
   -- proplist is a comma-delimited list of <cPropName><tDelim><value>, eg:
   --    put "tGender^M,tTown^Cambridge,nextAppt^1 month" into propList
   --    initializeCprops propList,the long id of this card,"^"
   -- tDelim defaults to <space> if empty
   -- from an example by Geoff Canyon, use-LC list,
   --    adapted by Peter M. Brigham, pmbrig at gmail.com
   if tDelim = empty then put space into tDelim
   split propList using comma and tDelim
   repeat for each key K in propList
      set the K of tObjRef to propList[K]
   end repeat
end initializeCprops

-- Peter

Peter M. Brigham
pmbrig at gmail.com

More information about the Use-livecode mailing list