Building a library with functions with callbacks

Dar Scott dsc at swcp.com
Mon Jul 11 19:34:33 EDT 2005


On Jul 11, 2005, at 4:08 PM, Alex Tweedly wrote:

> I want to build a library where some of the functions in it have 
> parameters which are callbacks;
>   agtMyFunction pData, pCallBackMessage

You can pass 'the long id of me' as an extra parameter.

If that is empty, you can use 'the target'.  That will work 95% of the 
time and is annoying the other 5%.  I think libURL uses that.

You can create a "callback value" that you pass, that includes the 
handler name and the object long id.

Often, you want to call a handler of a specific name and you need only 
pass the long id of the object.

You can vote for the enhancement in bugzilla to add a function to get 
this:  #1954.  Hmmm.  My search came up with 1243 and 2839, too.  Dups, 
maybe.

Your can write your own function to get the object of the caller using 
the executionContexts property.  The property is not supported, so I'd 
encourage the wrapper incase it changes.

Dar

-- 
**********************************************
     DSC (Dar Scott Consulting & Dar's Lab)
     http://www.swcp.com/dsc/
     Programming and software
**********************************************




More information about the use-livecode mailing list