[Gambas-user] SimpleEval

Fabien Bodard gambas.fr at ...626...
Wed Dec 30 07:21:06 CET 2015


>From the Main Module in the Farm example :


Public Sub Main()
  Dim hEval As New SimpleEval As "Eval"
  Dim hEx As New EvalEx As "Eval"

  'Test with an unknown variable
  hEval.Formula = "IF(Test=1;'TROUVE';'PERDU')"
  hEval.Execute
  If Not hEval.Error Then
    Print hEval.Value
  Else
    Print hEval.ErrorText
  Endif


  'Test extention
  hEx.Formula = "Message('coucou')"
  hEx.Execute

  'Test Both
   hEx.Formula = "Message(If(Test=1;'TROUVE ' & prenom;'PERDU'))"
  hEx.Execute

  'Test Calculation
  hEx.Formula = "Cos(1)+pi()*2^mypower"
  hEx.Execute
  Print hEx.Value

End


Public Sub Eval_Data(Value As String)

  If Value = "Test" Then
    Last.data = 1
  Endif
  If Value = "mypower" Then
    Last.data = 3
  Endif
  If Value = "prenom" Then Last.Data = "Fabien"


End

2015-12-30 7:10 GMT+01:00 Fabien Bodard <gambas.fr at ...626...>:
> You get the class from where ?
>
>
> 2015-12-29 15:18 GMT+01:00 Charlie <charlie at ...2793...>:
>> Hi Fabian,
>> I presume that you wrote the code in SimpleEval. I can't work out how to use
>> it. I thought it might work with my gbCalculator (see Gmabas Farm). There
>> are quite a few compile warning errors.
>> <http://gambas.8142.n7.nabble.com/file/n55114/CompileErrors.png>
>> *The main thing is some examples on how to use it please.*
>> Thanks.
>>
>>
>>
>> --
>> View this message in context: http://gambas.8142.n7.nabble.com/SimpleEval-tp55114.html
>> Sent from the gambas-user mailing list archive at Nabble.com.
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> Gambas-user mailing list
>> Gambas-user at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>
>
> --
> Fabien Bodard



-- 
Fabien Bodard




More information about the User mailing list