splash screen before app loads -- sample script?
Tereza Snyder
tereza at califex.com
Tue May 2 22:07:42 EDT 2006
On May 2, 2006, at 7:54 PM, Richard Gaskin wrote:
> Mark Smith wrote:
>> A very simple example would be where you have your mainstack
>> (called "splashStack") as a splash screen, and your actual logic
>> in a substack (called "logicStack").
>> In the script of stack "splashStack"
>> on startUp
>> show me
>> open stack "logicStack"
>> end startUp
>> in the script of stack "logicStack"
>> on openStack
>> doAllYourInitializing
>> hide stack "splashStack"
>> end openStack
>
> If the goal is to have something savable, rather than a substack
> he'll probably want a separate stack file:
>
>
> on startUp
> show me
> open stack "logicstack.rev"
> end startup
>
Also, give some thought to one central characteristic of standalone
stacks: their stack script acts like a library script for all stacks.
Stow your commonly-used utilities in that stack script, like say,
error handling and quit routines that you use in every app you make.
You might also attach, as substacks, your custom dialog stacks that
you use without change in all your apps (e.g. error display, user
registration, about screen, or custom ask and answer dialogs). On
card 2 of the Splash stack, which will never be seen, plop your
default menubar group, and any images you always need for cursors,
logos etc.
Put the startup code in the CARD script of the splash stack, where it
will be executed only once, on startup. Among its tasks might be
'looking around' in defined directories for the "logic stack", or
main stack of your application, and for other stacks like help stacks
or preference stacks or library stacks. If you always name these
stack files the same way, and always stow them in a predictable
location, you can set up the stackfiles property of the splash stack
to point to them; and your scripts will be able to find the
application stacks with a simple reference, without needing to know
their filenames.
You can initialize your essential globals, set the default directory,
set up Revolution characteristics... whatever.
The openstack script in card 1 of the Splash stack might send a "open
stack tMainstack in XXX seconds" and "hide stack tSplash in YYY
seconds" message to itself. This would make the slash stack entirely
self-contained. Once you have it working, you can reuse it without
editing it at all. Just install new main stacks, preference stacks,
help stacks, etc., double-click and go!
I follow this method, and if I weren't always thinking of
improvements, I would never have to build a standalone again. I store
all my application stacks in a subdirectory in a "resources" folder.
This resources folder is the same one I use in the application bundle
on macOS X, and that I park next to the .exe on windows. The startup
script looks either next to itself for "resources" or next to the
directory that contains itself (as it would in a bundle). The splash
has my company logo, and stays on the screen only a few seconds.
t
More information about the use-livecode
mailing list