Making handlers always available on startup

J. Landman Gay jacque at hyperactivesw.com
Sat Jan 10 11:30:04 EST 2004


On 1/8/04 5:26 PM, JonathanC at ag.nsw.gov.au wrote:
> From: Scott Rossi <scott at tactilemedia.com> wrote on Thu, 08 Jan 2004 
> 08:03:07 -0800
> 
>>On 1/8/04 4:03 AM, "JonathanC at ag.nsw.gov.au" <JonathanC at ag.nsw.gov.au>
>>wrote:
>>
>>
>>>I have come to Rev fairly recently from HyperCard. One of the things I
>>>liked to do in HyperCard was creating custom handlers and having them
>>>available in any stack. Some of these handlers would refer to other 
> 
> stacks
> 
>>>(usually in the same folder as the Home stack, so they could just be
>>>referred to by their short names rather than their full paths).
>>>...
>>>Isn't there the equivalent of a default "startUp" handler somewhere 
> 
> (like
> 
>>>HyperCard's)? If so, I couldn't find it.
>>
>>Isn't "start using stack xyz" what you want?
> 
> 
> Thanks, I know I can use that command, but:
> 1. How do I get Revolution to execute that command every time it starts 
> up?

Rev's Home stack is not accessible for editing, unlike HyperCard's.
Instead, use the Plugins feature. To do that, create a stack and put all
your custom handlers into the stack script. Include a preOpenStack (or
an openStack) handler on the first card that puts the stack in use. Save
the stack into Revolution's Plugins folder. Then restart Revolution and
choose your plugin stack from the Development->Plugins->Settings menu.
Set your stack to load every time Rev starts up.

The next time you launch Rev, it will automatically open your plugin
stack. The plugin stack's preOpenStack handler will put it in use. This
effectively creates a library that will be accessible all the time, just
as HC's home stack script was.

> 2. How can I refer to stacks (or stack files) just by their short names?

There are no globals for stacks, documents, or applications as there are
in HyperCard. There is a similar feature though, a property called the
stackfiles. You can set the stackfiles of a stack -- which is basically
just the short name and the file name of any number of stacks -- and Rev
will understand where the stack is when you refer to it by its short
name (look up "stackfiles" in the dictionary for details.) However, this
only works on a per-stack basis. There's no global way to link short
file names with file paths.

I haven't tried it, but you might experiment with setting the stackfiles
in your new plugin stack. Since that stack will be in use, its
stackfiles list might work globally as well, but I'm not sure. I'd be
curious to know, if you get a chance to try it.





More information about the use-livecode mailing list