custom properties

Steve Messimer steve at
Thu Feb 28 20:17:00 EST 2002


I would like to do a couple things with objects involving custom properties
and I just don't seem to able to figure out how to do them.  Certain Objects
I am creating depend on the presence of a controlling handler in a card's
script. I want to check a cd for the presence or absence of a custom
property.  If the property doesn't exist then I want to create it.  The
presence of the property will act as a flag that indicates that the object
has already had a controlling handler added to its script.

1. I want to be able to check for the existence of a custom property in an
object using a statement.

put the customProperties of cd objCard into propCker -- where objCard is any
card and propCker is a local var

Would the properties placed in propCker be placed there as in an array so I
could use a repeat structure to check for the presence of the property I'm
looking for.  This is what I have come up with thus far

repeat with i = 1 to the number of items in propCker
put item i of propCker into solomon -- solomon = a var
if theProp = solomon -- where theProp is the property I'm checking for,
 exit --  then property exists - don't alter Object's script
else ( theProp ‚ solomon ) - check another property
end if
end repeat
-- this will go through all the items in propCker  the problem arises in the
condition where propCker is either empty or doesn't contain theProp I'm
looking for.

or would the properties be placed in  the propCker a different way.

2. If the property in (1) doesn't exist I want to create it in the object

How would I create a new property in cd objCard?

put newProp in the customProperties of cd objCard -- where newProp is the
name of the new property

Any ideas will be appreciated.


Messimer Computing 

More information about the Use-livecode mailing list