[Gambas-user] Callback
    tobias 
    tobiasboe1 at ...20...
       
    Thu Aug 11 22:41:05 CEST 2011
    
    
  
hi,
> Or, see code:
>
> To class named "Twotimes":
>
> Static Public Function _call(x As Integer) As Integer
>    Return x * 2
> End
>
>
> Then somewhere else:
>
> ''This is the function that accepts callbacks.
> Public Function testing(x As Integer, ofunc As Object) As Integer
>   Return ofunc(x)
> End
>
>
> ''Here is how to call it.
> Dim ChosenFunction As Object
>
> ChosenFunction = New Twotimes ''Here you can set the callback function.
> Print testing(2, ChosenFunction)
>
>
> Jussi
  this is a very pretty workaround. i'll use that!
thanks
    
    
More information about the User
mailing list