"send mouseUp to…" vs "click at the loc of..".

Richmond richmondmathewson at gmail.com
Fri Jan 3 13:36:33 EST 2014


On 03/01/14 20:17, Richard Gaskin wrote:
> Stephen Goldberg wrote:
>
> > Just a note about a discovery I just made, in case it is not
> > generally known:  The speed of a script, especially when
> > dealing with many cards, is improved significantly by writing
> > "send mouseUp to…" instead of "click at the loc of…"
>
> Using "dispatch" is even faster, and faster still (and often more 
> robust) is for both scripts to make a direct call to a handler defined 
> further along the message path.

Really?

It seems that 'dispatch' has more capabilities than 'send':

When I tried this:

on mouseUp
    dispatch function "mouseUp" to btn "XYZ"
end mouseUp

NOTHING happened

when I did this:

on mouseUp
    send "mouseUp" to btn "XYZ"
end mouseUp

the mouseUp script in btn "XYZ" was executed.

as happened when I did this:

on mouseUp
   dispatch "mouseUp" to btn "XYZ"
end mouseUp

---------------------------

now btn "XYZ" contains a function:

function BlastMySocks
    put "socks blasted"
end BlastMySocks

and when I put this into the script of my other button:

on mouseUp
   dispatch function "BlastMySocks"
end mouseUp

the function is executed

THAT is not possible with 'send'

-----------------------------------

Well, I don't know about anybody else, but I am very grateful to Richard 
Gaskin for having taught me something
about Livecode I don't know after about 12 years with it, plus 10 with 
Hypercard, and a nagging feeling that I
look quite a twerp not having known that already!

Richmond.

>
> Where "click at the loc of..." is useful is in providing a visual 
> reinforcement for a user action, since the additional time is being 
> consumed by the button hilite, which can be very useful.
>
> For example, if you want a default button triggered by a doubleClick 
> in a list, having that button hilite momentarily as its script is 
> triggered helps remind the user of what exactly is happening, that the 
> doubleClick is really just a shortcut for clicking the button directly.
>
> But in cases where such affordance is of little or no value, indeed 
> bypassing the complex compositing routines needed to hilite the button 
> will make it much perkier.
>
> -- 
>  Richard Gaskin
>  Fourth World
>  LiveCode training and consulting: http://www.fourthworld.com
>  Webzine for LiveCode developers: http://www.LiveCodeJournal.com
>  Follow me on Twitter:  http://twitter.com/FourthWorldSys
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list