I guess I stumped everyone. :(
J. Landman Gay
jacque at hyperactivesw.com
Thu Nov 3 10:34:34 CST 2005
Charles Hartman wrote:
> Wow! Until I read this message it didn't occur to me that the
> preOpenStack in the main stack of the database app I'm working on was
> being called (I just checked) every time one of the five or six
> substacks opens. Since that handler opens the database and reads much
> of it into RAM, that would have gotten pretty awful if I hadn't known
> until there was a lot of data in there . . .
> This is a pretty bad pitfall. I've been surprised by this before
> (though I forgot it) -- that "preOpenStack" doesn't mean, as it so
> obviously seems to, "preOpenTHISStack" it means this stack and all its
> substacks . . .
It isn't really a "pitfall" -- just a normal effect of the standard
message hierarchy. All system messages go through the same hierarchy.
The preOpenStack message isn't any different than a "mouseup" or an
"openfield" or any of the others.
Messages go from the object to the card to the stack to the mainstack to
the engine (unless there are frontscripts, backscripts, or libraries,
which also then get inserted.) See Richard Gaskin's scripting conference
stack on the Message Hierarchy which lays out this behavior clearly,
complete with charts and graphs.
Stack authors can expect all messages -- including those you generate
yourself -- to follow this path. Any script in the path that has a
matching handler will catch the message and execute it.
I don't think it is possible to effectively program in any x-talk
environment without a firm familiarity with the message hierarchy. When
I teach people, it is one of the first concepts I introduce.
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode