1

I try to set some properties on a TForm instance that is "injected" into the script using TdwsRTTIConnector and the funcion:

procedure TForm1.OnFunctionEval_ConnectForm(info: TProgramInfo);
var
  c:TComponent;
begin
  c := Application.FindComponent(Info.ParamAsString[0]);
  if not (c is TForm) then
    Info.ResultAsVariant := Null
  else
    Info.ResultAsVariant := TdwsRTTIVariant.FromObject(c);
end;

The next script works fine except for the line f.FormStyle := 2; , get the error "Invalid class typecast"

showmessage('Step1');

var f:RttiVariant<Vcl.Forms.TForm> := ConnectForm('Form1');

f.AlphaBlendValue := 0;
f.AlphaBlend := True;
f.Hide;
f.Color := $00FFFF;

showmessage('Step2');

f.FormStyle := 2;
//f.FormStyle := TFormStyle(2);

f.Show;
f.AlphaBlend := False;

showmessage('Step3');

How can set enumerated properties like FormStyle or BorderStyle

Thanks

jamesgza
  • 11
  • 2

0 Answers0