1

I'm getting a compilation error "Invalid Operands" when compiling my dws script with RTTIVariable types. Is it possible for the following to work?

Declare variable which is a form.

gVar := ScriptUnit.Variables.Add;
gVar.Name := 'MDIForm';
gVar.DataType := SYS_RTTIVARIANT;
gVar.OnReadVar := onGetMDI;

procedure TGuff.onGetMDI(info: TProgramInfo; var value: Variant);
begin
  value := TdwsRTTIVariant.FromObject(FMDIForm);
end;

The script does not compile on this line. Seems it wants a string only.

if (length(MDIForm.edit1.Text) = 0) then

All help appreciated

LU RD
  • 34,438
  • 5
  • 88
  • 296
Tom Robertson
  • 151
  • 10
  • Maybe explicit the cast with: "if (length(String(MDIForm.edit1.Text)) = 0) then" – Eric Grange May 24 '13 at 09:01
  • Yes if I go varToStr it does work. However I have alot (200+) of scripts we are converting over to DWS. Moreover I don't want to have to do this going forward. – Tom Robertson May 24 '13 at 23:19

1 Answers1

0

This should now be supported in the trunk version, the type-check was a bit too strict and rejected RTTI (and OLE) variants.

Eric Grange
  • 5,931
  • 1
  • 39
  • 61
  • Thanks Eric, have downloaded latest gear and it works. Keep up the great work with DWS very happy with it. It is awesome. – Tom Robertson May 29 '13 at 02:24