calling functions in controls and groups

Dar Scott dsc at swcp.com
Tue Apr 16 14:18:01 EDT 2002


On Tuesday, April 16, 2002, at 09:37 AM, Rob Cozens wrote:

> FWIW, in this foole's vocabulary "handler" is a generic term 
> referring to commands and functions.

I took the time to look at About... Commands and Functions, again.

And, yes, I was abusing the vocabulary.  I think the distinctive 
names are these:

message handler
function handler

Paraphrased from the docs...  You "create a custom command" by 
creating a message handler with the name of the command.

> When calling a command, one must then call the result function to 
> get any value returned by the command.

That is what I was missing!  Thanks!  This is clearly described in 
the doc, but I may have missed it because it was in the context of 
errors and because I didn't see return in the example code when I 
glanced at it.

Well, I was also missing the notion that I want "send" not "call"; 
call does some interesting things to context.  I had somehow gotten 
the notion that "send" was a trivial "send ... in ...".  Not so.  
The "send" command does not defer execution, but executes right 
away.  I have gotten values back with result().

I'm not sure when it is cleared.  It seems to be cleared upon 
usage.  The example in the doc seems to imply it is cleared at 
other times, too, but I haven't discovered what those are.

BTW, I have found one way to make callbacks that may or may not 
have handlers.  I use "send ... in 0 milliseconds".

I realize that in many cases what I want are handlers for custom 
properties.  (And if I get my "lambda" values to work, this will be 
fine in all cases.)

Dar Scott






More information about the use-livecode mailing list