closestack handler wait 1 second error

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
tetsuo29
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 63
Joined: Thu Jun 07, 2007 1:30 am

closestack handler wait 1 second error

Post by tetsuo29 » Thu Jul 09, 2020 4:02 pm

Any ideas why this:

Code: Select all

on closeStack
   -- stop the timer
   if sTimerState is "running" then
      put "stopping" into sTimerState
   end if
   wait 1 seconds
  pass closeStack
end closestack
Is now producing this error in LC 9.6 (on Linux and Windows haven't test on Mac yet):
stack "Count It Down": execution error at line 277 (wait: aborted), char 1
Line 277 is:

Code: Select all

wait 1 seconds
I originally made this app in 2018, I forget which version of LC I was using but, it wasn't causing this error.

Klaus
Posts: 12089
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: closestack handler wait 1 second error

Post by Klaus » Thu Jul 09, 2020 4:12 pm

Just made a fresh new stack with no controls, added your script and closed it without any error.
macOS 10.14.6, LC 9.6

tetsuo29
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 63
Joined: Thu Jun 07, 2007 1:30 am

Re: closestack handler wait 1 second error

Post by tetsuo29 » Thu Jul 09, 2020 4:17 pm

I should clarify, this error is happening when closing the IDE with the stack open.

Klaus
Posts: 12089
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: closestack handler wait 1 second error

Post by Klaus » Thu Jul 09, 2020 4:30 pm

Aha, OK, just tested and still no error!?

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7168
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: closestack handler wait 1 second error

Post by dunbarx » Thu Jul 09, 2020 4:44 pm

Hi.

I will test also, but how are you closing the IDE? The handler you posted will not do so.

Craig

Klaus
Posts: 12089
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: closestack handler wait 1 second error

Post by Klaus » Thu Jul 09, 2020 4:45 pm

Maybe just QUIT? 8)

tetsuo29
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 63
Joined: Thu Jun 07, 2007 1:30 am

Re: closestack handler wait 1 second error

Post by tetsuo29 » Thu Jul 09, 2020 4:56 pm

dunbarx wrote:
Thu Jul 09, 2020 4:44 pm
Hi.

I will test also, but how are you closing the IDE? The handler you posted will not do so.

Craig
Just by choosing "Quit" from the File menu.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7168
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: closestack handler wait 1 second error

Post by dunbarx » Thu Jul 09, 2020 4:56 pm

Not sure what is pertinent here, but in a new stack with this in the card script:

Code: Select all

on closeStack
   -- stop the timer
  -- if sTimerState is "running" then
      --put "stopping" into sTimerState
 --  end if
  --- wait 1 seconds
   pass closeStack
end closestack
The stack window stays visible, even though the handler (visible because I was working from there) in the SE is deleted. Sending "closeStack" to the card by msg does the same thing. Of course, sending "close this stack" actually closes the stack.

The closeStack message is sent when the stack closes, and is not the trigger for that action just because it passes through that stack. But then why does the SE close the card script tab?

Craig

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7168
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: closestack handler wait 1 second error

Post by dunbarx » Thu Jul 09, 2020 4:58 pm

Just by choosing "Quit" from the File menu.
But that has nothing to do with your original issue, no?

Klaus, how did you do it? Same way?

Craig

Klaus
Posts: 12089
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: closestack handler wait 1 second error

Post by Klaus » Thu Jul 09, 2020 5:01 pm

Sure, since QUIT will close all stacks and they receive a "closestack" message.

BUT I raised the WAIT to 4 seconds and now I also see this error! :shock:

Klaus
Posts: 12089
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: closestack handler wait 1 second error

Post by Klaus » Thu Jul 09, 2020 5:15 pm

After reading up the dictionary, I am not sure if this is not desired behavior!?
Could you do this on closestackrequest?
That seems to be the right message for this.

tetsuo29
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 63
Joined: Thu Jun 07, 2007 1:30 am

Re: closestack handler wait 1 second error

Post by tetsuo29 » Thu Jul 09, 2020 6:49 pm

Klaus wrote:
Thu Jul 09, 2020 5:15 pm
After reading up the dictionary, I am not sure if this is not desired behavior!?
Could you do this on closestackrequest?
That seems to be the right message for this.
That did the trick! Thank you!

Of course, this is making me think that any things you might want to do before allowing a stack to close are safer in a closeStackRequest handler than they are in a closeStack handler because it now seems apparent that if something in your closeStack handler takes too long, it can generate an error.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5680
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: closestack handler wait 1 second error

Post by jacque » Fri Jul 10, 2020 5:30 pm

Note that closeStackRequest only fires if the user clicks the close box in the window title bar, it won't fire when quitting or closing the stack from a script.

Since you're quitting anyway, it doesn't seem necessary to reset the timer.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply

Return to “Talking LiveCode”