We have a desktop app and we are using Pascal Script for different events, for example on opening a menu, opening a record, record change, field change, etc. For all this events we have one or more pascal scripts, which are executed on the event.
If we make from all this scripts one script, which will have specific procedures for all the events, what is the most better way to call the procedures (from delphi code) when the event is triggered?
Now we are caching the compiled scripts and executing them when the event occurs.
I think I wasn’t very clear. Bellow is a test script, which is doing nothing
procedure OnMyOpenMenu(Sender: TObject);
begin
ShowMessage('Event: open menu');
end;
procedure OnMyRecordChange(Sender: TObject);
begin
ShowMessage('Event: on record change');
end;
procedure OnMyFieldChange(Sender: TObject);
begin
ShowMessage('Event: on record change');
end;
begin
end.
This script is compiled and executed once and cached in memory, without freeing the runtime and classimporter components.
When an event occurs in our application (the user opens a new menu), than we want to call OnMyOpenMenu event from the script (runtime).