Strange closeStack behavior

Bob Sneidar bobsneidar at iotecdigital.com
Mon Oct 4 19:44:19 EDT 2021


Okay, so I've come up with a relatively simple way to go about this. The problem is that when in standalone mode, closeStack does not close the splash stack, so the app keeps running even though there are no open windows, so I need to quit when the mainStack closes. 

But in Development mode, I don't want to quit because THEN Livecode quits, so I need to use close stack. 

So I put this code in the Mainstack's script and it seems to do the trick. 

on closeStackRequest
   put getParentStack(the long id of the target) into tParentStack
   
   if the short name of the target is "Main" then
      dispatch resetMainForm to the target
   else
      dispatch "clearForm" to tParentStack
   end if
   
   save stack tParentStack
   
   if the environment is not "Development" then
      send "quit" to me in 0 seconds
   else
      send "close stack tParentStack" to me in 0 seconds
   end if
   
   pass closeStackRequest
END closeStackRequest

BOB S
 

> On Oct 4, 2021, at 14:14 , Bob Sneidar via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> Got it thanks. That explains why I cannot even trap for closeStackRequest int othe substack script. The really odd thing is I can in the message box enter "close stack Time Calculator" and it closes without even bothering to ask if I want to save it, even when it is "dirty". 
> 
> I was thinking of checking the dirty flag on idle, with a constant or property to enable or disable auto save, then check for the dirty flag on idle + time delay and auto save the stack. 
> 
> This really is only an issue with development. It's a hassle to switch to the pointer tool, save the substack then switch back to the browse tool. 
> 
> I complained about this behavior a couple times, but there really is no graceful way to do this without some kind of a kludge. 
> 
> Thanks for the suggestion. 
> 
> Bob S





More information about the use-livecode mailing list