[Gambas-user] Callback

Bruce Bruen bbruen at ...2308...
Wed Aug 10 14:13:04 CEST 2011


On 10/08/11 08:26, tobias wrote:
>    
>> hi,
>>
>> i wonder how one would specify a function callback to a function (i
>> haven't tried anything because nothing seems to me to work). no way with
>> a functions name as string and Class[name] because i can't get a pointer
>> to the actual symbol via this method but only to a .Symbol object. i
>> also can't call a pointer (as it would be with passing the functions
>> address) or something because it is not possible to cast a pointer to a
>> function... or do i miss something here?
>>
>> regards,
>> tobi
>>      
> oh, well it's possible using Object.Call(Me, name) but why isn't there
> something like a Function datatype or the possibility to call a pointer?
> is it too risky or not easily possible (just read an older post on the
> list
> (http://old.nabble.com/Signal-11-with-callback-functions-td31128062.html) which
> says that there have to be wrappers between c and gambas functions
> (something that is clear but i haven't had in mind), but the more i
> think about it late at night, the more i get the idea that this isn't
> related to my problem)
> what i'd like to do is:
>
> Public Sub test(i As Integer)
>     Print i
> End
>
> Public Sub DoSomething()
>     Something(5, test)
> End
>
> Public Sub Something(i As Integer, callback As Pointer)
>     callback(i)
> End
>
> any ideas?
>
> ------------------------------------------------------------------------------
> uberSVN's rich system and user administration capabilities and model
> configuration take the hassle out of deploying and managing Subversion and
> the tools developers use with it. Learn more about uberSVN and get a free
> download at:  http://p.sf.net/sfu/wandisco-dev2dev
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>    
Um. It's late at night and my dev box is having a lie down.

Public Function Something(i As Variant, callback As String) as Variant
    Return Eval(subst("&1(&2)",callback,i)
End







More information about the User mailing list