How can I pass a handler a long ID as a string?

Geoff Canyon gcanyon at inspiredlogic.com
Wed Mar 22 10:59:28 EST 2006


I've hit this before. I generally postfix a cr like so:

   put (the long id of fld "myField" of cd "myCard" of stack  
"myStack") & cr into tParam
   myHandler tParam

Then in myHandler:

on myHandler pID
   delete char -1 of pID -- ready to go now

or if it could be a list:

on myHandler pIDList
   repeat for each line tID in pIDList

On Mar 22, 2006, at 6:47 AM, Graham Samuel wrote:

> I've never come across this before, and it's got me confused. I  
> have a handler, say "myHandler" that has a couple of parameters  
> which are intended to be the long ids of objects (actually fields).  
> The handler manipulates the fields, something like
>
>   on myHandler para1
>
>     do "put empty into"&&para1
>
>     ...
>
>   end myHandler
>
> I find that this works if the parameters are set in the same  
> context as the handler itself - for example in a 'mouseUp' handler  
> on the card where I've put the code of myHandler, but if I call it  
> from elsewhere with a call like
>
>    myHandler (the long id of fld "myField" of cd "myCard" of stack  
> "myStack")
>
> I find that during the call the engine evaluates the parameter and  
> passes me the contents of the field, and not the reference to the  
> field. What I want is to pass the long id to my handler as a  
> **string**. I can't see why this doesn't work, and more importantly  
> so far I'm stuck for a way round it. I've tried
>
>   put the long id of fld "myField" of cd "myCard" of stack  
> "myStack" into temp
>   myHandler temp
>
> but it has exactly the same effect.
>
> What am I doing wrong?
>
> TIA
>
> Graham
>
>
> ----------------------------------------
> Graham Samuel / The Living Fossil Co. / UK and France
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>




More information about the use-livecode mailing list