Virtual Custom Property Sample - Recursion Limit Problem

Jim Ault JimAultWins at yahoo.com
Fri Jan 12 13:41:24 EST 2007


As Eric described, the getProp/setProp messages are unlike others in the
respect that passing the message 'starts it at the card level' once again,
thus trapping its own message and entering an inescapable recursion loop.

Lock messages=true  will mean the unwanted message will not be introduced
into the hierarchy.  Actually, I find little or no value to the
getProp/setProp behavior and simply program a normal handler to do the task.
Every time I think that getProp will be an advantage, it turns out not to be
and no pesky recursion to thwart.

Jim Ault
Las Vegas


On 1/12/07 6:14 AM, "Bernard Devlin" <revolution at knowledgeworks.plus.com>
wrote:

> I am looking into virtual custom properties (specifically: using them
> to provide default values if a custom property of an object is empty
> or does not exist).  My understanding is that a getProp message
> should percolate up the message path, and when it finds a getProp
> handler it should be able to use whatever value is returned.
> 
> This sample from the Dictionary looks like what I am trying to do
> should be reasonable:
> 
>>> 
>   getProp expertSettings[thePropertyName]
>      -- The thePropertyName parameter contains the name of
>      -- the property that's being set
>      switch thePropertyName
>      case "fileMenuContents"
>        if the expertSettings[fileMenuContents] of the target \
>           is empty then return "(No items"
>        else pass expertSettings
>        break
>      case "editMenuContents"
>        if the expertSettings[editMenuContents] of the target \
>           is empty then return \
>           the noviceSettings[editMenuContents] of the target
>        else pass expertSettings
>        break
>      default
>        pass expertSettings
>      end switch
>    end expertSettings
> 
> <<
> 
> It seems to work fine when I put this in the MB:
> 
>       get the expertSettings["fileMenuContents"] of this stack
> 
> However, if I type this instead:
> 
>       get the expertSettings["fileMenuContents"] of this card
> 
> Then I get this error:
> 
>       Message execution error:
>       Error description: recursionLimit: Recursion limit reached
> 
> The stack I'm testing this in is a new stack with no controls on it
> (just the default card of any new stack).
> 
> Is the documentation wrong, or is it my understanding of it that is
> mistaken?
> 
> Bernard
> 
> P.S. The recursionLimit is at the default of 400000.  Incidentally,
> the TD says this should be 1000000 by default.  Since it is global
> property, I'm assuming that even if I changed it to 400000 in the
> past, it should be resetting itself to 1000000 on restart.  Is that
> right?
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution





More information about the use-livecode mailing list