Incompatible types

I'm evaluating FastScript 1.7 on BCB 6 and am falling at the first hurdle. I get an error compiling the following script. The fsScript1 error message is "Incompatible types: 'class String', 'String' at 1:21"
void __fastcall TForm1::Button1Click(TObject *Sender)
{
fsScript1->Clear();

fsScript1->Lines->Text = "{ ShowMsg(\"Hi there\"); }";

fsScript1->AddMethod("void ShowMsg(s:String)", CallMethod);
fsScript1->Parent = fsGlobalUnit();
fsScript1->SyntaxType = "C++Script";
if(!fsScript1->Compile())
  ShowMessage(fsScript1->ErrorMsg + " at " + fsScript1->ErrorPos);
else
  fsScript1->Execute();
}
One peculiarity: If I click Button1 a second time it all works fine!

Any help gratefully received

--
Antony

Comments

  • edited 12:43PM
    Have solved the problem by placing the assignment of SyntaxType above the Script specification as follows:
    void __fastcall TForm1::Button1Click(TObject *Sender)
    {
    fsScript1->Clear();
    fsScript1->Parent = fsGlobalUnit();
    fsScript1->SyntaxType = "C++Script";
    
    fsScript1->Lines->Text = "{ ShowMsg(\"Hi there\"); }";
    fsScript1->AddMethod("void ShowMsg(s:String)", CallMethod);
    
    if(!fsScript1->Compile())
      ShowMessage(fsScript1->ErrorMsg + " at " + fsScript1->ErrorPos);
    else
      fsScript1->Execute();
    }
    

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.