[Gambas-user] Callback
Benoît Minisini
gambas at ...1...
Thu Aug 11 17:32:19 CEST 2011
> 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
>
There is way to simulate callback functions by using the Object.Call()
function, which can call any method in any object by name. But it is slower
than a direct call.
An intermediate solution is when you can agree on the function name. Then you
can use inheritance, i.e. you change the class, but keep the same method name,
and make all these class inherit the same parent class.
Regards,
--
Benoît Minisini
More information about the User
mailing list