Page 1 of 1

Missing message

Posted: Mon Jul 02, 2012 6:47 pm
by snm
I have the stack with one card, and wanted to use "on preOpenCard" handler to clear fields content. But it didn't work at all - when I opened the stack, the fields content was still exist.

To check it I added second card and navigation buttons. Then I saw in the Message Watcher, that going from first card to the second there is preOpenCard message sent, but going back to the first card there is not preOpenCard in the Message Watcher.

What can be the reason, that preOpenCard message is not sent to this card?

Marek

Re: Missing message

Posted: Mon Jul 02, 2012 7:21 pm
by jmburnod
Hi Marek,

Where is the preopencard script ?

Jean-Marc

Re: Missing message

Posted: Mon Jul 02, 2012 10:02 pm
by snm
Handler is in 1-st card script.

Marek

Re: Missing message

Posted: Mon Jul 02, 2012 10:49 pm
by townsend
If you don't need that second card, delete that, with the Tools | Application Browser.
What you're describing should work. Maybe you can post your clear statements.
Maybe there's some syntax error in there. Or--- just put all your clear statements
in a button to see if they work at all. You're doing a put empty into field "some.name"
Make sure you put the reference "field" in there or LC will think you're referring
to local variables.

Put a Beep or Answer statement in the preopencard handler.
Is it being fired? How about the opencard handler?

Also, with a right click on the stack area, you should see an option,
Send Card Message. Use that to simulate a stack opening,
so you don't have to keep closing and opening your app.

Re: Missing message

Posted: Mon Jul 02, 2012 11:15 pm
by snm
Hi townsend,

The second card is for testing only. As I mentioned before there is no preOpenCard message sent when you go from 2-nd card to 1-st card, so the handler is not executed - you can't see this message in LC Message Watcher. If the message is not sent - the script in handler is not executed doesn't matter how the script is builded and what should do.

Said simpler: no preOpenCard message sent - no execution of "on preOpenCard" handler.

My question was what can be the reason of missing preOpenCard message before opening the card. I have not any problems with script used in the handler. It's simple put empty into fld "Field"', no way to make mistake.

When you go from card 1 to card 2, preOpenCard message is visible in LC Message Watcher in the sequence of messages.

Marek

Re: Missing message

Posted: Mon Jul 02, 2012 11:21 pm
by jacque
The behavior sounds like you accidentally put the handler into the script of the second card. Double-check. Any card that has a preOpenCard handler will execute it.

Re: Missing message

Posted: Mon Jul 02, 2012 11:31 pm
by snm
I know that already. Going to first card doesn't send preOpenCard message. Going to second card sends this message. I know it seems to be strange behavior. Message Watcher (the tool from LC Developer menu) shows any messages sent, but not preOpenCard when going to this one card. Going to any other card shows preOpenCard message there, and triggers preOpenCard handler script properly (even the same copied script).

Marek

Re: Missing message

Posted: Mon Jul 02, 2012 11:41 pm
by jacque
Are messages ever locked?

Re: Missing message

Posted: Tue Jul 03, 2012 6:20 am
by snm
Never by me and other(maybe not all) messages are sent and working. I have DG on this card, and it's set up with DGH - maybe there is the reason, but I can't find how to check it. I also made menu with Menu Builder there, but without puting any scripts there yet.

Marek

Re: Missing message

Posted: Tue Jul 03, 2012 6:39 pm
by jacque
Set a breakpoint in one of the handlers somewhere before you change cards and then step through the scripts using "step into" line by line. That should give you a hint where things are going off track. Something is blocking the message from being sent and stepping through the code can sometimes give you an idea where it happens.

Re: Missing message

Posted: Tue Jul 03, 2012 9:43 pm
by snm
When I'm opening the stack, the first handler which should be triggered is preOpenCard, but it doesn't because message is not sent. There is not any script run before open the card. No way to set any breakpoint before the handler. I set break as the first line of preOpenCard handler script. And nothing - script didn't start because the message was not sent.

I builded the stack from the beginning with new objects, copied all scripts from the wrong stack - everything is working as expected. It's the proof there is not bug in any script. Still no idea why preOpenCard is not sent in old stack.

Marek.

Re: Missing message

Posted: Tue Jul 03, 2012 9:56 pm
by jacque
I'm curious to see your broken stack. If you don't mind me looking, send a zipped copy to the email in my signature. Maybe I can tell what happened.

Re: Missing message - solved

Posted: Fri Jul 06, 2012 1:43 pm
by snm
Thanks to Jacque the problem is solved. He found in my stack, that there is geometry preferences set in custom property pane of faulty working card.

How to solve such problem if somebody experience it:
- check "LiveCode UI Elements in Lists" from menu "View"
- in "Card Property Inspector" choose "Custom Properties" pane
- select "Geometry property" set and trash it

Thanks a lot Jacque.

Marek

Re: Missing message

Posted: Fri Jul 06, 2012 8:14 pm
by jacque
Just to clarify a little more: there were geometry manager settings on the card, which are stored by LiveCode as a property set. Something in those settings was apparently causing a problem or was in conflict with the LC geometry scripts, which run when a card opens. The scripts were aborting due to the error and no further engine messages were sent.

Deleting the custom property set removes the geometry from the card so LiveCode won't try to run any geometry scripts. It solves the problem with the error. Geometry needs to be set up again, since the instructions are now missing. If the same geometry is used the problem may recur, but I'm thinking it was due to an inadvertent conflict that would be hard to repeat.