Stacks getting 'disconnected'

Ken Ray kray at sonsothunder.com
Mon May 2 17:11:57 EDT 2005


On 5/2/05 1:22 PM, "Stephen Barncard" <stephenREVOLUTION at barncard.com>
wrote:

> In the process of trying to make an answer dialog (plan b), I ran
> across another problem. When opening a new window/sub-stack, does
> this automatically 'stop using' other stacks? When I closed this new
> sub-stack, somehow the connection to a library was stopped. Do I have
> to always define the 'default stack' every time??

Steve, check your "closestack" and "openStack" handlers in your main
stack... these can be triggered by substacks that open/close if the substack
itself doesn't have its own openstack/closestack handlers.

And if you're intention is to stop using other stacks when the mainstack
closes, closing a substack might accidentally trigger this effect.

If this is the problem, several methods exist to solve the problem:

1) Put your openstack/closestack/etc. messages in the first card of the main
stack, not the mainstack itself. This will trigger properly when the
mainstack closes, but is not in the message hierarchy when substacks close.

2) Put explicit openstack/closestack/etc. handlers in your substacks, even
if they are "stubs" (i.e. on openstack/end openstack).

3) Leave the handlers in the mainstack's stack script, but use this "if":

on <message>
  if the owner of the target is me then
    -- do your mainstack-specific stuff here
  else
    pass <message>
  end if
end <message>


If this is *not* the problem, you can ignore everything I just told you. ;-)

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




More information about the use-livecode mailing list