Again with the start using

Richard Gaskin ambassador at fourthworld.com
Wed Mar 3 21:30:19 EST 2004


Dar Scott wrote:

> What I'd like to do is select a default so it works just by somebody 
> dropping it into an app.  I'd like to have options to accommodate those 
> who don't see the world the way I do.
> 
> In all that it should be easy and work right off.  If folks have 
> different approaches to handling, say, preOpenCard, then that gets 
> hard.  If some folks hide preOpenCard from the libraries, then some 
> other method would be needed.

If you need access to system messages, the most reliable place to hook 
into them is in a fronscript.

While we can debate the relative efficacy of using the engine's built-in 
messages vs. inventing any manner of mirrored versions of those for 
libraries, frontScripts are a special, sacred place.

I would not heitate to describe a frontscript intended for general use 
that doesn't pass all system messages as a bug to be reported to the author.

There may be specialized cases where blocking messages before the target 
gets them is desirable, but such tools would be highly specialized and 
should come with warning signs in bright neon to avoid folks pulling 
their hair out trying to figure out why their scripts no longer trigger.

> I had made the silly assumption that, of course, everybody passes 
> preOpenCard.

If frontScripts they do.  If not it's either a bug, or a very unusual 
tool that should be wearing the afore-mentioned neon sign around its neck.

> I now have to think on how to make sure all works whether it is passed 
> or not.

Just use frontScripts for system-message traps and backscripts or 
libraries for custom handlers and you're set.

The only problem with frontScripts is the number available at runtime, 
currently limited to 10.  But in practice, as often as I use 
frontScripts I've never needed more than three in all of the stuff I've 
ever built.

Far more common than system message traps are collections of custom 
routines, for which libraries are ideal and you can use up 50 at runtime.

-- 
  Richard Gaskin
  Fourth World Media Corporation
  ___________________________________________________________
  Ambassador at FourthWorld.com       http://www.FourthWorld.com


More information about the use-livecode mailing list