Integration into application
I've downloaded a trial Fast Script hoping to plug it into my project for automation service. There r some point that i con't figure out w/out ur help.
1. Is there a way to get access to the forms, controls & ect. of the main application from FS (not FR! *s*)
2. How 'bout the COM? I mean, is there a foreseen option to use COM. I must admit that it's not a prob to write own class under FS emunation that will support such stuff, but why should I do it if there might be one?
Lookin' forward ur reply for further colsulting.
Sincerelly, Scott
1. Is there a way to get access to the forms, controls & ect. of the main application from FS (not FR! *s*)
2. How 'bout the COM? I mean, is there a foreseen option to use COM. I must admit that it's not a prob to write own class under FS emunation that will support such stuff, but why should I do it if there might be one?
Lookin' forward ur reply for further colsulting.
Sincerelly, Scott
Comments
just add your form class
fsGlobalUnit.AddClass(TForm1, 'TForm');
and any controls instance
fsScript1.AddObject('Form1', Self);
and you can use it in a script.
2) COM is not supported yet, and no plans to implement it in the nearest future.
When i try to acess a child object from the Form declared in the source, i give a
'Stack Overflow' exception. Can i acess the child controls in the form just placing the
form in AddClass method ? Is there a way to do this? Ps: Sorry my bad english.
fsScript1.Clear;
fsScript1.AddObject('Form1', Self);
fsScript1.Lines := Memo.Lines;
fsScript1.SyntaxType := LangCB.Items[LangCB.ItemIndex];
fsScript1.Parent := fsGlobalUnit;
if the Script:
var
Result: string;
begin
Result := Form1.Label3.Caption;
end.
it??s compile, but on Execute gives a 'Stack Overflow' exception.
Do i have to declare the 'Label3' object too ?
Or, you can add Label3 object by AddObject method and access it as Label3.
Thanks.
Since i??ve been purchased the Fast Script component, i??m trying to acess the components in the Application, without sucess. I??ve tried to put:
fsScript1.AddForm( ... )
fsScript1.fsGlobalUnit.AddClass( ... )
fsScript1.AddObject( ... )
It??s compiles ok, but in the execution, gives me a 'Stack Overflow' error.
I??m still trying to acess the components in Form1 that was referenced in the Addform method.
fsScript1.AddForm(Form1);
in the script:
begin
Form1.Caption := 'Test'; // works ok
Form1.Label1.Caption := 'Test'; // Stack Overflow.
end.
Can you send me true samples of integration with the application ? Something like
references to objects in a form (form application, not created in the Script), references to a DataBase and DataSets from DataModules, and more.
How to reference the objects in the Form1 ?
Can i access or atribute the events in the objects ? something like:
begin
Form1.Label1.OnClick := @ClickHere;
end.
procedure ClickHere;
begin
ShowMessage('You Click!');
end;
Sorry bad english.
Thanks.
begin
Form1.Label1.OnClick := @ClickHere;
end.
procedure ClickHere;
begin
ShowMessage('You Click!');
end;
Yes, it works.
begin
Form1.Label2.Caption := 'It works!';
end.
You said that the form can be added just one time. Every time i create the form, is that the problem ?
In the next time i??ll create the MDI form, compile, execute but nothing happened.
I thinked in a way to determine if the Form1 was already added in the fsGlobalUnit, so don??add it again... i??ve tried to put 'fsGlobalUnit.Remove(Form1)' in the close event, but dont works....
Sorry bad english, any sugestion ?
Thanks a lot.