on suspendStack trapped

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
MrAlobar
Posts: 70
Joined: Mon Dec 08, 2014 6:42 pm

on suspendStack trapped

Post by MrAlobar » Thu Apr 02, 2015 7:26 pm

I'm in a trap...

Trying to debug my app which uses the suspendStack message (to carry out some tasks when the app loses focus).

I trod the well worn path of inserting 'answer...' in the handler, but now I am trapped in a loop between the IDE and the stack...

Using the IDE suspends the stack, which pops up the answer box, which locks everything until the 'ok' is clicked, which of course resumes the stack, ready to repeat again..

Anyone know the solution - ctrl '.' doesn't work.
Couldn't find anything from a google search, nor search of this forum.
I can't be the first to fall down this hole, surely !

Cheers,
Jay
I've Created it with Live Code, I've published it - that's the easy bit done, but how the hell do I get people to download it :?

MrAlobar
Posts: 70
Joined: Mon Dec 08, 2014 6:42 pm

Re: on suspendStack trapped

Post by MrAlobar » Thu Apr 02, 2015 7:50 pm

...to answer my own question.. found after much experimenting...

send the answer box away (click ok)
click the code editor
send the answer box away again
ctrl tab hides the palettes
ctrl tab reveals the palettes
then click the code editor and editing is allowed

Variations on this worked too, the common thing being the two lots of ctrl tab.

Not sure why it works or what it is doing (locking messages maybe ?), not experimented any more than that and not seen it documented anywhere.

Can anyone enlighten me ?

Back to debugging again...
I've Created it with Live Code, I've published it - that's the easy bit done, but how the hell do I get people to download it :?

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: on suspendStack trapped

Post by FourthWorld » Thu Apr 02, 2015 9:03 pm

Using "put" instead of "answer" will provide feedback in a way that doesn't keep sending suspendStack events.

There may be even better ways to debug such things, depending on what your suspendStack handler is doing. Can you share that handler so we can see what it needs to do?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

MrAlobar
Posts: 70
Joined: Mon Dec 08, 2014 6:42 pm

Re: on suspendStack trapped

Post by MrAlobar » Fri Apr 03, 2015 11:03 am

Hi Richard,
Thanks for the suggestion of 'put', I'll try it.

My suspend handler is very simple and not the cause of the problem I was trying to track down...

on suspendStack
if gShrink is "true" then shrinkStack
pass suspendStack
end suspendStack

I inserted the answer message as the first line to report the state of certain aspects of the code.

On reflection, I think I need to learn to use the debug mode better, with step through and breakpoints - I'm missing a trick I think.
I've Created it with Live Code, I've published it - that's the easy bit done, but how the hell do I get people to download it :?

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: on suspendStack trapped

Post by FourthWorld » Fri Apr 03, 2015 4:01 pm

Is gShrink declared in that script?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: on suspendStack trapped

Post by jacque » Fri Apr 03, 2015 4:23 pm

Whenever you find yourself in a situation where your script takes over like that, click on the Messages icon in the toolbar. That turns off all engine messages and the offending handler will no longer trigger. Then you can revise the script.

Remember to turn it back on again later or you'll wonder why nothing works.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

MrAlobar
Posts: 70
Joined: Mon Dec 08, 2014 6:42 pm

Re: on suspendStack trapped

Post by MrAlobar » Fri Apr 03, 2015 7:15 pm

Hi FourthWorld,
Yes gShrink is declared - handler works fine.

Hi Jacque,
I tried that but no interaction with the IDE is possible.

Try creating a stack with nothing in it but an answer command in an on suspendStack.
I've Created it with Live Code, I've published it - that's the easy bit done, but how the hell do I get people to download it :?

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Re: on suspendStack trapped

Post by SparkOut » Fri Apr 03, 2015 10:26 pm

This might be the opposite of what you need, but under tools, development menu, you could disable the development environment to see how your stacks behave without interference from the ide

MrAlobar
Posts: 70
Joined: Mon Dec 08, 2014 6:42 pm

Re: on suspendStack trapped

Post by MrAlobar » Sat Apr 04, 2015 10:29 am

Hi SparkOut,
Yep that is useful, I've used it a few times. But in this instance that trap still springs. The IDE cannot be disabled when the stack is running as clicking any button outside the stack send the suspend message, the dialogue needs acknowledging before anything else can be done, this is the loop trap.

Ctrl tab, ctrl tab is the way out, I'm just not sure why it works.
I've Created it with Live Code, I've published it - that's the easy bit done, but how the hell do I get people to download it :?

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: on suspendStack trapped

Post by jacque » Sat Apr 04, 2015 8:07 pm

Try creating a stack with nothing in it but an answer command in an on suspendStack.
I tried it, but I'm not getting the same results. I do get the answer dialog when I click into the IDE but after dismissing it, I am able to work with the IDE stacks and objects, toggle toolbar icons, select from the tool palette, type into the message box, etc. I'm on a Mac if that makes a difference, and I tested in LC 6.7.3.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

MrAlobar
Posts: 70
Joined: Mon Dec 08, 2014 6:42 pm

Re: on suspendStack trapped

Post by MrAlobar » Mon Apr 06, 2015 4:25 pm

That's interesting, thanks Jacque.
I'm on Windows 8.
I'll set up Mac OSX in a VM and try it.
It'll be next week as I'm away from my computer this week. I'll report back what I find.
I've Created it with Live Code, I've published it - that's the easy bit done, but how the hell do I get people to download it :?

Post Reply