handlers not firing
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
handlers not firing
Hello LiveCoders!
In my application I have some of handlers that were to be working until yesterday, but now the code never gets executed. I have gone through every part of LiveCode I can find, but I cannot figure out how to fix this. In particular, I have a startup handler in the script for my main stack that opens and creates the database. Without that code executing, everything else fails.
btw - I noticed my version was 7.06, so I upgraded to the latest stable version - 7.1.0 Build 10043.
EDIT...
ok, so not sure how I ever got that to work in the first place. I created new stack, added the handler, it seems there isn't a startup message (when I watch the messages.) So which message should I be using? There is a resumeStack message. I guess I will try that.
EDIT...
I am going to try the openStack message. If anyone has any feedback, great, otherwise I will consider this closed.
In my application I have some of handlers that were to be working until yesterday, but now the code never gets executed. I have gone through every part of LiveCode I can find, but I cannot figure out how to fix this. In particular, I have a startup handler in the script for my main stack that opens and creates the database. Without that code executing, everything else fails.
btw - I noticed my version was 7.06, so I upgraded to the latest stable version - 7.1.0 Build 10043.
EDIT...
ok, so not sure how I ever got that to work in the first place. I created new stack, added the handler, it seems there isn't a startup message (when I watch the messages.) So which message should I be using? There is a resumeStack message. I guess I will try that.
EDIT...
I am going to try the openStack message. If anyone has any feedback, great, otherwise I will consider this closed.
Re: handlers not firing
Hi.
If you think about it, giving the handler name is critical to helping you. What had you used before?
Think also about using an "openCard" handler in the stack script. This fires a bit after the stack has loaded, since the first card has to load as well, and catches things that "openStack" (and certainly "preOpenStack") will not. It is good practice, unless you explicitly need to do work early in the stack loading process.
Craig
Code: Select all
I am going to try the openStack message.
Think also about using an "openCard" handler in the stack script. This fires a bit after the stack has loaded, since the first card has to load as well, and catches things that "openStack" (and certainly "preOpenStack") will not. It is good practice, unless you explicitly need to do work early in the stack loading process.
Craig
Re: handlers not firing
Thanks Craig!
I was using startup, which shows up in the dictionary - maybe it is deprecated? I never could see the message in the message watcher.
so far openStack is working fine. Thanks!
I was using startup, which shows up in the dictionary - maybe it is deprecated? I never could see the message in the message watcher.
so far openStack is working fine. Thanks!
Re: handlers not firing
Hi.
Startup is not deprecated, but depending on what you are up to, it may fire too early in the, er, startup process, and miss stuff. You cannot appreciate this until it bites you. That is why, unless, as I said, there is a reason to trap a very early message, trap a late message instead. Usually, the intent is to do something when the stack "opens". But this invariably can wait until all the objects are loaded, and, you might say, the stack has indeed "opened".
Craig
Startup is not deprecated, but depending on what you are up to, it may fire too early in the, er, startup process, and miss stuff. You cannot appreciate this until it bites you. That is why, unless, as I said, there is a reason to trap a very early message, trap a late message instead. Usually, the intent is to do something when the stack "opens". But this invariably can wait until all the objects are loaded, and, you might say, the stack has indeed "opened".
Craig
Re: handlers not firing
Hi 2hup,
1. welcome to the forum!
2. The "startup" message is caught by the LC IDE, this will only work in your standalone(s)!
Best
Klaus
1. welcome to the forum!

2. The "startup" message is caught by the LC IDE, this will only work in your standalone(s)!
Best
Klaus
-
- VIP Livecode Opensource Backer
- Posts: 10052
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: handlers not firing
The useful thing about the startup message is that it's a very convenient way to do initialization unique to a standalone.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: handlers not firing
I usually use preOpenStack or openstack to get around the IDE trap. Using opencard can cause interference if the stack has more than one card.
Or you can have the best of both worlds:
Or you can have the best of both worlds:
Code: Select all
on preOpenStack
if the environment is "development" then startup
end preOpenStack
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: handlers not firing
Thank you Jacque - that looks like a good solution.
Brad
Brad