Virtual Custom Property Sample - Recursion Limit Problem

Eric Chatonet eric.chatonet at sosmartsoftware.com
Fri Jan 12 09:33:37 EST 2007


Hi Bernard,

To avoid recursion when using get or setProp, just try to lock messages:

lock messages
put the expertSettings["fileMenuContents"] of this card -- in the msg

In addition, you have to know that running code from the message box  
sometimes leads to weird results:
Always prefer to create on-the-fly a new stack and put your code in a  
brand new button :-)

As for global properties, you are right:
recursion limit will be set to  one million when launching Rev.
If you set it to another value, this new value will be used in all  
open stacks during the current session only.

Hope this helps.

Best Regards from Paris,
Eric Chatonet

Le 12 janv. 07 à 15:14, Bernard Devlin a écrit :

> 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?

------------------------------------------------------------------------ 
----------------------
http://www.sosmartsoftware.com/    eric.chatonet at sosmartsoftware.com/





More information about the use-livecode mailing list