send ___ to me in ___ sec

Jan Schenkel janschenkel at yahoo.com
Wed Apr 24 04:25:17 EDT 2002


--- Dar Scott <dsc at swcp.com> wrote:
> 
> On Tuesday, April 23, 2002, at 11:28 PM, J. Landman
> Gay wrote:
> 
> > [snip]
> >
> > There is no need ever to "send in 0". Simply issue
> the command. These
> > two lines are equivalent:
> >
> >    send "myHandler" to me in 0
> >    myHandler
> 
> Those are not quite equivalent.  I think you mean
> these two are:
> 
>      send "myHandler" to me
>      myHandler
> 
> This one...
> 
>      send "myHandler" to me in 0
> 
> ...will be executed after any ready messages in
> pending messages.  
> 
>  [snip]
> 

_send "myHandler" to me in 0_ may be necessary if
there's a chance of an exit to top higher up in the
message chain.

e.g. if you want a field to be automatically formatted
as the user types, and you may or may not pass the
keydown event higher up, and it might get trapped
there for some reason, you may end up with an
unformatted field unless you use the send in 0 form.

> [snip]
> 
> >
> > If you have messages waiting in (your private)
> pendingMessages queue,
> > they are sent at the appropriate time and are
> inserted into the normal
> > stream of system messages whenever they come due.
> Your private pending
> > messages are time-based rather than event-based.
> They just get stuck
> > into the stream as needed.
> 
> This may be misleading.  It seem that ready messages
> in the pending 
> messages will be executed before any messages that
> might be 
> generated by events even if event times mix with due
> times in the 
> pending messages.  At least that is the way it is on
> my OS X.
> 

Actually, Dar, this is a normal consequence of the way
applications work : while they're busy they might or
might not capture the event of an impatient user
hammering the keyboard or clicking around.
It all depends on how they handle multiple tasks --
and I still have to see the first gui that is
inherently multi-threaded, so no wonder su much events
get missed.

I'd actually be much more inclined to lock messages
during a lengthy process, just to make sure the user
doesn't accidentally fire that lengthy process a
second time.

Also, in order to avoid data-race problems like in
Java's threaded environment, it's better if the
pending messages are handled first, and the gui events
afterwards.

Just my two euro-cents,

Jan Schenkel.

"As we grow older, we grow both wiser and more foolish
at the same time."  (De Rochefoucald)

__________________________________________________
Do You Yahoo!?
Yahoo! Games - play chess, backgammon, pool and more
http://games.yahoo.com/



More information about the use-livecode mailing list