Error Assigning Button1Click Event in TMS Scripter

Hello,

I am creating a form using TMS Scripter and adding the form to the scripter with the following code:

With atScripter1.AddScript(slPascal) Do
Begin
  UnitName := 'FormLib';
  SourceCode.Text := MemFormLib.Text;
  DesignFormResource := MemFormDFM.Text;
  ScriptInfo.FormResource := MemFormDFM.Text;
  Compile;
  SelfRegisterAsLibrary(UnitName);
End;

I am adding the source code to the scripter with:

{$FORM TForm1, FormLib.sfm}

procedure Button1Click(Sender: TObject);
begin
  ShowMessage('Test');
end;

I want to assign the Button1Click event to the Button1 component in the DFM. However, I am getting the following error:

Project Project1.exe raised exception class EReadError with message 'Error reading Button1.OnClick: Invalid property value'.

How can I solve this error? Can you help me?

Thank you!

You can't do that from the dfm. The event handlers in TMS Scripter are saved in a custom way.

In the case of event handlers in dfms, you can only use the dfms saved by the Scripter IDE itself.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.