before vs on in behavior scripts - red herring alert!

Devin Asay devin_asay at byu.edu
Thu Mar 20 13:01:36 EDT 2014


On Mar 20, 2014, at 9:54 AM, Richard Gaskin <ambassador at fourthworld.com>
 wrote:

> Devin Asay wrote:

> > So it appears that each time I launch the project I have to reassign
> > the behavior to the buttons. This only seems to happen for behaviors
> > stored in library stacks. I have seen a similar problem with objects
> > that were assigned a background pattern stored in a library stack.
> 
> As much as I love behaviors, the finicky way they're resolved has been an annoyance for me:  you have to make sure that any behavior script objects are loaded before any object that uses them.
> 
> For example, if you have a mainstack which is an executable and contains objects that use behaviors, and a separate library stackfile which contains the behavior buttons, it will always fail because that mainstack is opened before the library is loaded, so the resolution will be attempted before the objects they resolve to can be known.
> 
> The workaround is as you've discovered: you have to write code to reassign the behavior on the fly.
> 
> To simplify this occasional necessity, I had hoped the team would have implemented a command they once talked about in the early days of behaviors but never quite got around to: "resolve behaviors", which would trigger the same resolution mechanism that happens when stacks are first loaded, but could be called whenever you need it.
> 
> FWIW I submitted a request for that:
> <http://quality.runrev.com/show_bug.cgi?id=8993>

Thanks, Richard and Jacque,

I'm sure, somewhere in the cobwebby corners of my brain, there is a dusty memory of this discussion, but it takes me multiple times getting bitten by it to wrestle it from the grip of my inner slack-jawed yokel. I'll have to write a "poker" in my preopenStack script to force the resolution. I like Jacque's suggestion to load the libraries first, then the main project stack. I also like Richard's enhancement request, and I'd vote for it if we still had votes. It might not be a bad idea, Richard, to bump the version number up in the enhancement request to the latest release, maybe it'd get some attention. 

Thanks all,

Devin



Devin Asay
Learn to code with LiveCode University
http://university.livecode.com







More information about the use-livecode mailing list