setprop handlers for custom property sets

Paul Dupuis paul at
Thu Jul 30 12:21:06 EDT 2015

The LC 6.7.5 dictionary entry for setProp has the following:

If the custom property you want to control is in a custom property set,
use array notation in the first line of the setProp handler, as in the
following example:

  setProp mySet[thisProperty] newValue
if thisProperty is "that" then put newValue into me
  end setProp

The above setProp handler responds to changes in the custom property
named "that", which is a member of the custom property set named "mySet".

First, this example throws a syntax error in the IDE script editor, I
think because last line should be "end mySet" vs "end setProp".

Second, it appears you can NOT have individual setProp handlers for
custom properties in custom property sets. I.e. if mySet contain the
customer properties "that" and "this" and "those", I can not have:

setProp mySet["this"] tValue
  -- do something
end mySet["this"]

setProp mySet["that"] tValue
  -- do something else
end mySet["that"]

and so on. It appears you can only have a single setProp for the whole
custom property set as in:

setProp mySet[whichproperty] tValue
  switch whichproperty
     case "this"
        -- do something
     case "that"
         -- do something else
  end switch
end mySet

Is this true? Is there a way to have individual setprop handlers for
specific properties in a custom property set? The lask of clean, easy to
read, setProp handlers for properties in a custom property set would
seem to reduce the value of custom property sets for organizing groups
of properties. Perhaps it is better to just have all properties in the
default property set?

More information about the Use-livecode mailing list