use-revolution Digest, Vol 80, Issue 81

Richard Gaskin ambassador at fourthworld.com
Tue May 25 12:33:27 EDT 2010


Peter Haworth wrote:

> I'm glad to gear such a simple solution!  My concerns were all based
> on the following in the dictionary entry for "behavior":
>
> "The behavior property is a reference to a button containing the
> script to use. It is in the format of a long ID."
>
> I guess I need to be more careful about believing what the dictionary
> says!
>
> Pete Haworth

The docs are kinda correct, but just don't tell the whole story (I'm 
cc'ing support here so the Dictionary entry can be updated to reflect 
the full story):

You can use the long ID of a button to set the value of the behavior 
property for an object, but once it's set it gets stored using only the 
short name of the stack the behavior button is in.

This is explained more fully in the ParentScriptNotes.txt document 
included with the Rev install:


    PARENT SCRIPTS - RESOLUTION

    A control's parent script reference is saved in the stackfile
    as three pieces of information:
      1) button id
      2) stack name
      3) mainstack name (if stack is substack)
    This is the minimum required information to uniquely identify
    a button within a running Revolution environment.

    Immediately after loading a stack file, an attempt is made to
    resolve all parentScript references - the engine acts as if
    it constructs a control reference:
      button id <id> of stack <stack name> [ of stack <mainstack name> ]
    And attempts to access it. Thus, the stackFiles property will be
    searched as appropriate and any needed stacks will be loaded.

--
  Richard Gaskin
  Fourth World
  Rev training and consulting: http://www.fourthworld.com
  Webzine for Rev developers: http://www.revjournal.com
  revJournal blog: http://revjournal.com/blog.irv



More information about the use-livecode mailing list