Occurs when scripter finishes to compile script.property OnAfterCompileStage: TPaxScripterEvent;Use the OnAfterCompileStage event to display a message that the compilation process has been ended.
Example
procedure TFormMain.PaxScripter1AfterCompileStage(Sender: TPaxScripter); begin if CompileAndRun and (not PaxScripter1.IsError) then begin CompileStatusWindow.Hide; Exit; end; if PaxScripter1.IsError then begin CompileStatusWindow.LabelStatus.Caption := 'Done: There are errors'; CompileStatusWindow.LabelError.Caption := 'PaxScripter1.ErrorDescription'; end else begin CompileStatusWindow.LabelStatus.Caption := 'Done'; CompileStatusWindow.LabelError.Caption := 'Successful'; end; end;
Occurs when script running has been finished.property OnAfterRunStage: TPaxScripterEvent;Use this event to display a message that script running has been finished.
Example
procedure TFormMain.PaxScripter1AfterRunStage(Sender: TPaxScripter); begin if PaxScripter1.IsError then ShowMessage('Ok') else ShowMessage('Terminated. There are errors'); end;
Allows to assign a script to scripter.property OnAssignScript: TPaxScripterEvent;Use AddModule, AddCode, AddCodeFromFile methods to assign a script to a scripter inside of the OnAssignScript event handler body.
Example
implementation {$R *.DFM} procedure TForm1.Button1Click(Sender: TObject); begin PaxScripter1.Run; end; procedure TForm1.PaxScripter1AssignScript(Sender: TPaxScripter); begin PaxScripter1.AddModule('main', paxBasic); PaxScripter1.AddCode('main', 'print Form1.Caption'); PaxScripter1.RegisterObject('Form1', Form1); end;
Occurs before scripter compiles a script.property OnBeforeCompileStage: TPaxScripterEvent;Use The OnBeforeCompileStage event to initialize objects which will reflect the compilation progress.
Example
procedure TFormMain.PaxScripter1BeforeCompileStage(Sender: TPaxScripter); begin CompileStatusWindow.LabelProject.Caption := 'Project: ' + ProjectName; CompileStatusWindow.Show; end;
Occurs before scripter runs a script.property OnBeforeRunStage: TPaxScripterEvent;Use the OnBeforeRunStage event to add breakpoints to scripter and update objects which reflect the state of your IDE.
Example
procedure TFormMain.PaxScripter1BeforeRunStage(Sender: TPaxScripter); begin SaveProject; RemoveTraceLine; AddBreakpoints; end;
Occurs when scripter compiles a script.property OnCompilerProgress: TPaxScripterEvent;Use the OnCompilerProgress event to update objects which reflect the compiler progress.
Example
procedure TFormMain.PaxScripter1CompilerProgress(Sender: TPaxScripter); begin Application.ProcessMessages; CompileStatusWindow.LabelStatus.Caption := 'Compiling: ' + PaxScripter1.CurrentModuleName; CompileStatusWindow.LabelCurrLineNumber.Caption := IntToStr(PaxScripter1.CurrentSourceLine); CompileStatusWindow.LabelTotalLinesCount.Caption := IntToStr(PaxScripter1.TotalLineCount); end;
Occurs when compiler finds $define directive.property OnDefine: TPaxScripterDefineEvent;
Example
Click here
Occurs when scripter processes Halt statement at run-time.property OnHalt: TPaxScripterEvent;
Example
Click here
Occurs when compiler finds $include directive.property OnInclude: TPaxScripterIncludeEvent;
Example
Click here
Occurs when scripter processes declaration of an external procedure or function.property OnLoadDll: TPaxLoadDllEvent;
Example
Click here
Occurs when interpreter executes the print statement.property OnPrint: TPaxScripterPrintEvent;Use OnPrint event to customize execution of the print statement.
Example
procedure TFormMain.PaxScripter1Print(Sender: TPaxScripter; const S: String); var K: Integer; begin FormConsole.Show; K := FormConsole.Memo1.Lines.Count; if K = 0 then FormConsole.Memo1.Lines.Add(S) else FormConsole.Memo1.Lines[K-1] := FormConsole.Memo1.Lines[K-1] + S; end;
Occurs when scriptes loads compiled module from a stream.property OnReadExtraData: TPaxScripterStreamEvent;Allows you to read custom data from a compiled script.
See Also
Occurs at the script run-time.property OnRunning: TPaxScripterEvent;Use OnRunning event to process messages at the script run-time.
Example
procedure TForm1.PaxScripter1Running(Sender: TPaxScripter); begin Application.ProcessMessages; end;
Occurs when PaxScript errors raises.property OnShowError: TPaxScripterEvent;Use OnShowError event to customize showing error in your IDE.
Example
procedure TFormMain.PaxScripter1ShowError(Sender: TPaxScripter); var Editor: TMemo; begin Editor := FindEditor(Sender.ErrorModuleName); Editor.SelStart := Sender.ErrorTextPos; Editor.SelEnd := Sender.ErrorTextPos; LabelBottom.Caption := 'Error: ' + Sender.ErrorDescription; end;
Occurs when paxScript parses the uses statement (paxPascal), the imports statement (paxBasic), the using statement (paxC).property OnUsedModule: TPaxUsedModuleEvent;
Example
type THandler = class procedure HandleEvent(const UsedModuleName, FileName: String; var SourceCode: String); end; procedure THandler.HandleEvent(const UsedModuleName, FileName: String; var SourceCode: String); begin if UsedModuleName = 'AModule' then SourceCode := 'Unit AModule; interface var X = 10; implementation end.'; end; var P: TPaxScripter; L: TPaxPascal; H: THandler; begin P := TPaxScripter.Create(nil); L := TPaxPascal.Create(nil); H := THandler.Create; try P.OnUsedModule := H.HandleEvent; P.RegisterLanguage(L); P.AddModule('main', L.LanguageName); P.AddCode('main', 'uses AModule in "MyFile";'); P.AddCode('main', 'print X;'); P.Run; finally P.Free; L.Free; H.Free; end; end;Using OnUsedModule event, you have possiblities:
- Assign source code of module. If module UsedModule does not exist, it will be created.
- Check whether the FileName file exists and if the file does not exist you can create it.
Occurs when scripter saves compiled script to a stream.property OnWriteExtraData: TPaxScripterStreamEvent;Allows you to add a custom data to a compiled script.
See Also