preOpenStack, openStack in Card 1?? Rules conformation
Richard Gaskin
ambassador at fourthworld.com
Thu Mar 30 14:34:03 EST 2006
David Burgun wrote:
> I don't tend to use sub-stacks but I do use multiple cards. I tend to
> have a new mainStack (e.g. separate .rev files) for each main window.
> Although I will could use sub-stacks in the future if there were a
> good reason.
I use substacks less and less, and rarely in the stack that is the
application. These days my app stack is just a light shell which looks
into a Components folder for all the program's meat. This approach lets
me update components from within the application on the fly if needed,
right in the user's current session.
>> Initialization of course needs to be done only once, and the
>> mainStack's first card will be the first recipient of the startup,
>> openStack, and preOpenStack messages. The startup message is only
>> sent at runtime (the IDE gets it in development), so to get
>> initialization in both development and runtime I use preOpenStack
>> instead.
>
> I use preOpenStack to initialize the app too. I have the handler
> defined in Card 1 of the (only) mainStack, so this should work if I
> add sub-stacks?
Sure. As a card script, it'll have no effect on any substacks in the file.
> I hadn't really thought about it, I'm not sure if the
> mainStack should initialize itself and all it's sub-stacks or whether
> sub-stacks should initialize themselves when they opened.
I don't have a hard-and-fast rule on that myself, though I tend to
initialize only the things I need to when I need them. I really like
getting from double-click to ready-to-work as quickly as possible. It's
been pleasing to eliminate the splash screen from many programs because
they load so fast; when the splash is only visible for a fraction of a
second it's more of a distraction ("what was that?" than a help. :)
> Also I am not clear of the path the preOpenStack and openStack
> handlers take. For a mainStack I'm guessing its:
>
> mainStack:Card1:preOpenStack and if not defined mainStack: preOpenStack.
>
> But how about a sub-stack?
>
> subStack:preOpenStack ??
For a diagram of the firing order see:
<http://www.fourthworld.com/embassy/articles/revolution_message_path.html>
--
Richard Gaskin
Managing Editor, revJournal
_______________________________________________________
Rev tips, tutorials and more: http://www.revJournal.com
More information about the use-livecode
mailing list