Can Handler Know What Params It Should Have

Bernard Devlin bdrunrev at gmail.com
Wed Feb 3 06:28:24 EST 2016


Hi Hermann

Even with the "LC handler" it's not quite giving me what I'd like. It's
still providing data from params(), rather than, for example, returning

mouseUp pNumberOfMouseButtonClicked.

I was hoping that a handler could provide information about itself at
compile time, rather than simply what was passed to it during runtime.

Regards
Bernard

On Tue, Feb 2, 2016 at 8:16 PM, [-hh] <hh at livecode.org> wrote:

> Bernard wrote:
> > I know the params can be called to find out what parameters were
> > passed to the handler when it is called. However, I'm wondering
> > if a handler has a way of knowing what parameters it had at the
> > time it was defined. I don't think so. Regards Bernard
>
> Yes, that's my opinion too, for user handlers, but not for LC/reserved
> handlers. This is the simple explanation I use for myself:
>
> [1] For any *user handler*, the answer is NO, because there are
> not "the parameters" in a definition. For example
>
> on handler x1,x2
>  put ( x1,x2 )
> end handler
>
> is equivalent to
>
> on handler
>  put ( param(1),param(2) )
> end handler
>
> [2] For a *LC handler* we can see the defined params by calling the
> params in the handler without params. For example
>
> on mouseUp
>  put the params
> end mouseUp
>
> yields: MouseUp "1" (if left-clicked)
> Means: We can use, where b is the 'reserved' LC param, for example
>
> on mouseUp b,x1,x2
>  put (x1,x2)
> end mouseUp
>
> or equivalently
>
> on mouseUp
>  put (param(2),param(3))
> end mouseUp
>
> =======
> Hermann
>
> _______________________________________________
> 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