Page 1 of 1
Give me advice on how to debug
Posted: Sat Apr 19, 2014 6:40 pm
by Mag
Hi all,
Please give me advice on how to debug a stack.
There is a main stack and a series of substacks, when I open the substack with this command:
In develop mode the preOpenStack, openStack, openCard, preOpenCard, openControl works fine. In OS X standalone they are not trigged.
PS
Maybe I have to use Open stack instead of Go to stack?

Re: Give me advice on how to debug
Posted: Sat Apr 19, 2014 7:16 pm
by jmburnod
Hi Mag,
Check "sheet stack" in the LC dictionary
Best
Re: Give me advice on how to debug
Posted: Sat Apr 19, 2014 7:28 pm
by Mag
Thank you for posting jmburnod, unfortunately, no changes... Also removing the "as sheet" property didn't work.

Re: Give me advice on how to debug
Posted: Sat Apr 19, 2014 9:25 pm
by jacque
Often if it looks like messages aren't being sent, what is really happening is that there is a script error somewhere that is aborting everything that follows. One way to find out if that's the case is to add an errorDialog handler to the stack script, and have it tell you if a script error occurs. Put this into the stack script:
Code: Select all
on errorDialog pErr
answer "An error occured:" && pErr
end errorDialog
Errors will be returned as a series of cryptic numbers. If you look up "errorDialog" in the dictionary it explains what those numbers mean. Another way to look them up is to get the LiveCode Error Lookup stack from the User Samples area. You can type in the first number returned, and it will give you the same error description that the IDE does.
A fancier way to do the same thing is write the error to a text file on disk instead of using "answer." That lets you copy the error text and paste it into the multi-line lookup field in the Lookup stack. Usually a single error triggers a whole sequence of related errors, and seeing them all at once tells you the "chain of command" that is failing.
It's easier to see it than explain it. For most purposes, usually all you need to look up is the first number in the list on the top line, so "answer" is good enough.
Re: Give me advice on how to debug
Posted: Sat Apr 19, 2014 10:48 pm
by jmburnod
Hi Mag,
I never used "sheet stack".
I just tested it with a substack and it works for me
You have to trap the preOpenStack, openStack, openCard messages in the substack script otherwise that is preOpenStack, openStack, openCard messages
in the main stack will be called
Best regards
Jean-Marc
Re: Give me advice on how to debug
Posted: Sun Apr 20, 2014 2:03 pm
by Mag
Hi jmburnod, thank you so much. I tested your stack and works well, also in sandalone and with openCard message.
Hi jacque, thank you for your tips, it was just the thing I needed. I had the handler and in standalone (non in development mode) actually shows errors.
Now, I will try to learn what kind of errors are.
Re: Give me advice on how to debug
Posted: Sun Apr 20, 2014 6:13 pm
by jacque
Okay, good. We read those lines from the bottom up. Each new error is put on top of the previous one. So in reverse order:
353: Name:
The compiler can't identify the exact problem, which is why the line number is zero, but there is something wrong with the name of something in the stack script
241: there's an error in the statement on line 559 in the preOpenStack handler
253: the error is in the if-then statement
246: there's an object in that line that can't be found
88: the object is a card referenced in that line
Since it works in the IDE and not in a standalone, the script may be looking for a card that exists only in the IDE. Or the card may be in a stack that isn't open or isn't in the message path.
Re: Give me advice on how to debug
Posted: Sun Apr 20, 2014 7:09 pm
by jmburnod
Hi Mag
Did you put a preOpenStack and openStack messages in your substack ?
And if you have a preopencard or opencard messages in your main stack you have also to put a preopencard or opencard messages in your substack
Re: Give me advice on how to debug
Posted: Mon Apr 21, 2014 1:27 pm
by Mag
Hi jacque and Jean-Marc!
Thank you, with your help I solved the problem. It was a preOpenStack handle that was trigged every time I opened a substack (the problem appeared only when in standalone). I have lot of substacks so, to solve the problem, instead to put the preOpenStack in each of them, I put a if structure in main stack and now all works fine.
Code: Select all
if the short name of this stack is xyz then
--
end if
Thank you again!