Newbie - MainStack Question

Ken Ray kray at sonsothunder.com
Sat Jul 26 12:33:01 EDT 2003


> Wouldn't even be better to avoid these workarounds completely 
> be simply 
> using the main stack as a generic routine holder?

If you like, but then you have to manage an "invisible" mainstack that
is launched. I guess the first question is more one of construction: 

A) if your intention is to have a single .rev file that contains
multiple windows (i.e. substacks), then using the mainstack as a
"handler holder" is a good idea, IMHO. 

B) If your intention is to have a single .rev file that shows only 1
window, you don't need any substacks at all, and all the code can go in
the mainstack.

C) If your intention is to thave multiple .rev files that represent
their own windows, you might do a combination of the above.

Also note that you have the ability to use library stacks (stacks whose
sole purpose is to hold handlers and functions used by any stacks
currently running), so there's another option as well.

Personally, I do (A) most of the time, and so if I want something to
happen only once when my mainstack is launched, I use:

on preOpenStack
  if the owner of the target is me then
    -- Do mainstack stuff
  end if
end preOpenStack

Just my thoughts...

Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/ 





More information about the use-livecode mailing list