Demo with inputs and outputs to delphi application
here is my code for inputs and outputs.....
When i run the script, i get an error 'incompatible types' then i run it a 2nd time, there is no error?
What is causing the incompatible types ERROR?
{Form has Edit1, Edit2, Memo1, Label4, Button
}
procedure TForm2.bRunClick(Sender: TObject);
var
a,b: integer;
begin
label4.Caption := '0';
fsScript1.Clear;
fsScript1.AddVariable('a','Integer', a);
fsScript1.AddVariable('b','Integer', [img]style_emoticons/<#EMO_DIR#>/cool.gif" style="vertical-align:middle" emoid="B)" border="0" alt="cool.gif" />; fsScript1.Lines := Memo1.Lines; fsScript1.Parent := fsGlobalUnit; if fsScript1.Compile then begin fsScript1.Execute; Label4.Caption := IntToStr(fsScript1.Variables); end else // execute if compilation was succesfull Label4.Caption := fsScript1.ErrorMsg; //show an error message end; function TForm2.fsScript1GetVarValue(VarName: string; VarTyp: TfsVarType; OldValue: Variant): Variant; begin if VarName='a' then Result := StrToInt(Edit1.Text) else if VarName='b' then Result := StrToInt(Edit2.Text); end; {script code in memo1 var i : integer; begin i := a + b; end. }[/img]
When i run the script, i get an error 'incompatible types' then i run it a 2nd time, there is no error?
What is causing the incompatible types ERROR?
{Form has Edit1, Edit2, Memo1, Label4, Button
}
procedure TForm2.bRunClick(Sender: TObject);
var
a,b: integer;
begin
label4.Caption := '0';
fsScript1.Clear;
fsScript1.AddVariable('a','Integer', a);
fsScript1.AddVariable('b','Integer', [img]style_emoticons/<#EMO_DIR#>/cool.gif" style="vertical-align:middle" emoid="B)" border="0" alt="cool.gif" />; fsScript1.Lines := Memo1.Lines; fsScript1.Parent := fsGlobalUnit; if fsScript1.Compile then begin fsScript1.Execute; Label4.Caption := IntToStr(fsScript1.Variables); end else // execute if compilation was succesfull Label4.Caption := fsScript1.ErrorMsg; //show an error message end; function TForm2.fsScript1GetVarValue(VarName: string; VarTyp: TfsVarType; OldValue: Variant): Variant; begin if VarName='a' then Result := StrToInt(Edit1.Text) else if VarName='b' then Result := StrToInt(Edit2.Text); end; {script code in memo1 var i : integer; begin i := a + b; end. }[/img]
Comments
I will not order the component if this error remains.
Thanks
Rolf
The order of statements is important.
This works: without error.
This code: generated an error when the script was run the first time. Afterwards no error occurred.
When i run the script, i get an error 'incompatible types' then i run it a 2nd time, there is no error?
What is causing the inco