Custom Properties

Mark Wieder mwieder at ahsoftware.net
Wed Apr 12 20:46:07 EDT 2006


Jacque-

> example, the above could also be done by:

>    setEditMode true

In this case, yes. But what if the setEditMode handler were in a
group? What if you had several groups, each with its own setEditMode
handler? You would have to say

send "setEditMode true" to group 1 of card 2
send "setEditMode true" to group 2 of card 2

etc, or you could say

set the setEditMode of group 1 of card 2 to true
set the setEditMode of group 2 of card 2 to true

so the syntax comes out about the same either way

> Now I'm curious what's the advantage, if any, of using a setProp handler
> over a standard command handler? This isn't just to you, Devin, but to
> anyone who uses these regularly.

I don't think there's a big difference either way. I think setProp is
slightly faster, but no enough to warrant changing styles just for
that. There are also differences in parameter passing: you can place
complex data in a setProp parameter that will fail when you try it
with a "send" command. But you can't "set" array data as easily as you
can "send" it. And setProp error handling is easier - you end up
setting a harmless custom property instead of triggering a runtime
error if there's no handler and you haven't used a try construct.

-- 
 -Mark Wieder
  mwieder at ahsoftware.net




More information about the use-livecode mailing list