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

Graham Samuel livfoss at mac.com
Wed Mar 22 09:47:57 EST 2006


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




More information about the use-livecode mailing list