setptop handler and recursion limit?

Klaus major-k klaus at
Fri Jun 24 07:24:50 EDT 2016

Hi Mark,

> Am 24.06.2016 um 13:19 schrieb Mark Waddingham <mark at>:
> On 2016-06-24 13:12, Klaus major-k wrote:
>> I have a handler in the stack script like this:
>> setprop whatever tValue
>>   set the whatever of the target to tValue
>>   answer "The property whatever has been modified for" && the target
>> end x_value
>> And on a card I have a button:
>> ...
>> set the whatever of this cd to 22
>> ...
>> Now in LC 8.01 I get "Recursion limit" error!?
>> I thought that this would not happen for setprop handlers?
>> See my setprop script, I actually need to "pass" the message
>> to really set that value. Know what I mean?
> I think the docs cover this:
> -----
> 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.


Thanks a lot, looks like this is the part that I did not understand completely 8-)

> 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.
> end myCustomProperty
> To avoid this problem, set the lockMessages property to true before setting the custom property.
> ----
> You have a setProp handler in the stack, but are setting it on the card - as the target of the object
> is not the same as object containing the setProp handler then you need to use 'lock messages' around the set in the setProp handler.

OK, that was my thought, but was not sure, thanks again!

> Warmest Regards,
> Mark.



Klaus Major
klaus at

More information about the Use-livecode mailing list