Avoiding recursion with a setProp handler
Klaus Major
klaus at major-k.de
Sun Aug 22 20:59:55 EDT 2004
Hi David,
> MC 2.5's help stack says that "when you set an object's property from
> within a setprop handler, setprop messages are not sent." Is this
> true?
>
> Here's my handler:
>
> setProp beenChanged whether
> put the short date into fld 3
###set the beenChanged of this stack to whether -- (without this,
the setProp handler intercepts the calling command, and the property is
not set)
pass setprop ## ;-)
> end setProp
> When some other handler commands "set the beenChanged of this stack to
> true", my setProp handler gets called. But when I watch the message
> watcher, it appears that the second line of my setProp handler is
> recursively calling the setProp handler, and I get a "recursion limit
> reached" error.
>
> I realize that I could easily avoid resorting to a setProp handler at
> all, but I was tempted by the ease with which I thought it would allow
> me to add some behavior I had not thought of when I first wrote a lot
> of handlers that "set the beenChanged of this stack." Having come
> this far, I would like to understand how to use setProp properly.
See above, simply "pass"ing the "setprop" will finally SET THIS PROP :-)
Hope this helps.
> Many thanks.
>
> David Epstein
Best from germany
Klaus Major
klaus at major-k.de
http://www.major-k.de
More information about the metacard
mailing list