Hello,
Delphi code:
oView := oGrid.CreateView(TcxGridDBTableView) as TcxGridDBTableView;
How to call CreateView() in script?
TIA and best regards
Branko
It should work like any other method (except you don't need the "as TcxGridDBTableView" part).
The problem is illustrated with the simple example below.
--- Delphi code:
type
TClassAClass = class of TClassA;
TClassA = class
end;
TClassB = class(TClassA)
end;
TMyClass = class
procedure Foo(AClass: TClassAClass);
end;
procedure TMyClass.Foo(AClass: TClassAClass);
begin
ShowMessage(AClass.ClassName);
end;
procedure TMainForm.Button1Click(Sender: TObject);
begin
Scripter.DefineClassByRTTI(TClassB, '', [mvPublic, mvPublished], True);
Scripter.DefineClassByRTTI(TMyClass, '', [mvPublic, mvPublished], True);
Scripter.SourceCode.LoadFromFile('scr_myclass.pas');
Scripter.Execute;
end;
--- Script scr_myclass:
var
oClass: TMyClass;
begin
oClass := TMyClass.Create;
try
oClass.Foo(TClassB);
finally
oClass.Free;
end;
end;
--- RUNTIME ERROR
Invalid class typecast when evaluating instruction PushVar ($0,$0,$0,$0,'Result').
Stack content is: [Integer:50477088].
Source position: 10,6
Position: 10, 6.
Hi Franc,
I sent you mail.
Thank you, it works now!
For several years I use FlexCel (since ver 3), excellent product and great support by Adrian. I started using scripter a few days ago, but I can say for it the same as for FlexCel - excellent product and support. Thank you!
Thank you for your nice words, Franc. If you need anything else, just let us know.
This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.