On Mon, Jan 22, 2018 at 2:20 PM, Geoff Canyon via use-livecode < [email protected]> wrote:
> Is there any reason script-only stacks had to be implemented in the engine? > It is nice that you can store the scripts for controls in a UI stack alongside of the ui stack file. You just set the stackfiles property of the UI stack and then opening the UI stack opens up all of the behavior stacks that the UI stack requires without any extra effort on the part of the developer. > Is there any reason *not* to implement their equivalent in about five lines > of code in the mainstack of a project? i.e., For some cases dispatching a message can be useful. I don't think I would use `openStack`, however, as that doesn't describe the event that is occurring. You are just loading the stack into memory. A script only stack can create a UI and may expect the `openStack` message to be dispatched at the proper time and in the proper sequence relative to other messages that are sent when actually opening a stack. I wouldn't load all of my script only stacks that way, however. I use script only stacks in a variety of ways. For libraryStacks they already get a `libraryStack` message. If I'm using them as behaviors for controls in a UI stack then they are automatically loaded by the engine for me as described above. In the majority of cases that doesn't require any extra work. In the Levure framework you can specify that a stack file will be use specifically as a behavior. In the case Levure will dispatch a `LoadBehavior` message to the stack and it can assign itself a behavior. My preference is for the ability to set a script only stack behavior in the script only stack itself. -- Trevor DeVore ScreenSteps www.screensteps.com _______________________________________________ use-livecode mailing list [email protected] Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
