I'm currently using Scripter Studio Pro v. 2.0 and I think I found a bug.
I've implemented my own version of the TScriptForm class and have event handlers for the OnCreate and OnClose events. However I noticed that every time I implement an OnClose event handler for a Form in my script the event handler in my TScriptForm descended class is never raised even though I have set the EventSetMode of the of the IDEScripter component to esAddEventOnTop. While looking through the source code I found that in the RestoreSavedEvents of the TScriptForm class you have this code:
procedure TScriptForm.RestoreSavedEvents;
procedure SetEventFromString(CompName, PropName, RoutineName: string);
var
Comp: TComponent;
begin
if UpperCase(CompName) = 'SELF' then
Comp := Self
else
Comp := FindComponent(CompName);
if Assigned(Comp) and Assigned(RunScript) and Assigned(RunScript.Scripter) then
begin
RunScript.Scripter.EventBroker.SetEvent(Comp, PropName, RoutineName, RunScript.Scripter,
epReplaceCall, RunScript);
end;
end;
var
c: integer;
CompName: string;
EventName: string;
StrName: string;
P: integer;
begin
//...
end:
So it looks like the script event always replace the event in the class regardless of what the RestoreSavedEvents property is set to.
I'm not sure if this is a bug, this is a behavior that mimics Delphi behavior. TScriptForm is an internal class and if you are using a different one, you are descending from it, so why not override virtual methods instead of setting events, since it would be a much better practice?
That property are for events set from script, for existing Delphi objects that are supposed to already have events. The script form is not an "existing" object, in the sense it's not in your application being used by some business code. It's explicitly designed and created for scripting.