Haunted by "error in statement" when there is no e

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
gyroscope
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 404
Joined: Tue Jan 08, 2008 3:44 pm
Contact:

Haunted by "error in statement" when there is no e

Post by gyroscope » Sun Jun 29, 2008 10:09 pm

Hi, in the three months that I've been using RR, the main culprit which has taken the shine off the enjoyment of using this great prog is the error message "error in statement" with the line: open card 1 of stack "XYZ"; open stack "XYZ", go stack "XYZ", etc.

The "joke" is, with something as simple as on mouseUp;open stack "XYZ";end mouseUp, even though it throws up an error message, the substack still opens...

I took me a long time to work out what was going on until I discovered the simple principle that the on preOpen/Open/CloseStack handlers refers to all substacks as well. By putting empty handlers in the relevant places in these substacks, I thought I had solved the problem.

(confirmation here please: any preOpen/Open/CloseCard handlers refer to the particular card which contains the handler, and to no other card, is that correct please?)

OK, back to my haunting... whithout changing any main Stack handlers for quite a while now, still the error message has suddenly appeared again. I'm at a loss to know what else is causing this message.

If anyone has any idea what else could be happening here, I'd be thrilled (really!) to know what the solution is. Or if I could be so bold as to suggest that someone looks at the stack to see what's going on, perhaps? If you solved this, I'd be that pleased, I'd buy you a pint...no, two...:wink:

:?

bjb007
Posts: 313
Joined: Fri Dec 28, 2007 4:56 am

Haunted by "error in statement" when there is no e

Post by bjb007 » Sun Jun 29, 2008 11:14 pm

gyroscope

My limited experience has taught me
that an error message can't always be
taken at face value.

Only a few hours ago I had an error which
referred to "preOpen".

That stack doesn't have a "preOpen" or any
mention of one.

Sometimes errors take some detective work
but as I was told once by the IT manager "We
can't anticipate every silly thing that users will
do and provide an error message for them".

My answer is to look in unexpected places. There's
always some small thing in there somewhere.
Life is just a bowl of cherries.

gyroscope
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 404
Joined: Tue Jan 08, 2008 3:44 pm
Contact:

Post by gyroscope » Sun Jun 29, 2008 11:39 pm

Hi bjb007, thanks for your advice; the only thing is I've spent many (wasted) hours over the three months trying to track down this problem and its caused quite a bit of despair, I can tell you! (Ahh, poor me... :wink:)

It'd be brilliant to finally get a solution to this problem from someone else as I'm really mightily fed up with it and as far as I know, gone as far as I can to track down the cause... :(

rozek
Posts: 151
Joined: Mon Jun 19, 2006 2:29 pm
Contact:

Post by rozek » Mon Jun 30, 2008 6:37 am

Good morning!

I'm not an RR expert, although I'm currently trying to become one...well, at least, kind of...

The problem is, that - in detail - RR is far less intuitive than it claims to be, and getting RR scripts fool-proof needs a lot of Transcript experience.

Concerning your problem: please keep in mind, that the main stack is in the message path of all its substacks. In practice, this means that *every* message which was originally sent to an object of the substack (but not handled within the substack itself or passed on along the message path) also reaches the main stack.

Therefore, within the script of your mainstack, you should always check that a message you handle in there was indeed sent to the object you expected. To be more precise: prepend your message handlers with lines like

Code: Select all

if (the target is not me) then pass <message>
or

Code: Select all

if (StackOf(the target) is not the long id of me) then pass <message>
where "StackOf" is a function which was described in this forum some days ago.

Many of the message handlers in my main scripts have this kind of lines at their beginning - especially those of my library stacks.
Kind regards,

Andreas Rozek

gyroscope
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 404
Joined: Tue Jan 08, 2008 3:44 pm
Contact:

Post by gyroscope » Mon Jun 30, 2008 11:22 am

Thank you for that info, rozek; you've cleared the air a bit more for me concering the message path. I think I might "pepper" my stack with (the target), just to be on the safe side...

This looks like the solution I was after, thank you again 8)

:)

PS For interest, bjb007 has kindly offered to look at my stack with a new pair of eyes, as it were; I guess he will confirm this info (unless there's some other dodgy scripting I've done which is adding to the problem...)

rozek
Posts: 151
Joined: Mon Jun 19, 2006 2:29 pm
Contact:

Post by rozek » Mon Jun 30, 2008 1:18 pm

Hello!

It's nice to see that I could give back a little bit of all the help I got in this forum (and will hopefully still get in the future)
Kind regards,

Andreas Rozek

Post Reply