setProp and Lock messages
ambassador at fourthworld.com
Sun Dec 4 14:10:51 CST 2011
> I think the reference to the documentation not being believable alluded to
> the LC documentation not the datagrid documentation. The LC Reference
> Manual and the dictionary are old and definitely contain inaccuracies. On
> the topic of setprop and recursion, for example, the reference manual
> clearly states that you don't need to user lock messages to prevent
> recursion but, as several people have mentioned in this thread, you do.
Here's what the docs say with regard to recursion for setProp:
Caution! If a setProp handler in one object's script sets the
custom property for a different object, and the first object
is in the second object's message path, a runaway recursion
will result. For example, if the following handler is in a
card script, and you set the "myCustomProperty" of a button
on the card, runaway recursion will result:
setProp myCustomProperty newValue
set the myCustomProperty of the target to newValue + 1
-- Because the target is the button, and this handler is in
-- the card, the above statement sends another setProp trigger
-- to the button.
To avoid this problem, set the lockMessages property to true
before setting the custom property.
I believe that's correct, and have not experienced any bugs which differ
from that description.
Has anyone here found a recipe for a behavior which contradicts that
LiveCode training and consulting: http://www.fourthworld.com
Webzine for LiveCode developers: http://www.LiveCodeJournal.com
LiveCode Journal blog: http://LiveCodejournal.com/blog.irv
More information about the use-livecode