dispatch/send question

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
phaworth
Posts: 592
Joined: Thu Jun 11, 2009 9:51 pm

dispatch/send question

Post by phaworth » Sat Apr 10, 2010 11:29 pm

If I issue a dispatch or send command to an object on a card that is not open at the time, what happens to the resulting message? Does the object see it even though the card is not open, or is it somehow queued until the next time the card is opened, or does it just disappear never to be seen again?
Thanks,
Pete

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: dispatch/send question

Post by Mark » Sun Apr 11, 2010 3:06 am

Hi Pete,

If the stack with the object is available in memory, the message will pass all the objects until it is caught by a handler and executed.

If you use the send command and the object is not in memory or the object doesn't exist or if the message isn't caught by a handler, you will get an execution error. If you use the dispatch command, you won't get an error (according to the docs).

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

phaworth
Posts: 592
Joined: Thu Jun 11, 2009 9:51 pm

Re: dispatch/send question

Post by phaworth » Sun Apr 11, 2010 7:08 am

Thanks Mark. I guess I'm not familiar enough with Rev to know just what "in memory" means. Let's say I'm in the IDE and open my main stack file which has several substacks, none of which are opened at startup. Does the fact that I opened the main stack mean that all the substacks are in memory, or do the substacks have to be opened before they're in memory?

Thanks,
Pete

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: dispatch/send question

Post by Mark » Sun Apr 11, 2010 3:01 pm

Hi Pete,

After a stackfile is opened, all substacks that are part of that stackfile are in memory.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Post Reply