1

How do you retrieve record parameters from a TProgramInfo object in the Eval events for functions in a TdwsUnit? It seems that the object only provides ways to retrieve the basic datatypes directly or possibly a script object.

FHannes
  • 783
  • 7
  • 22

1 Answers1

2

You can use the Members[] property to access record members, for instance if you have a script variable p of type TPoint, you can access and set the X/Y members with

var p : IInfo;
...
p:=Info.Vars['p'];

px := p.Member['x'].Value;
py := p.Member['y'].Value;

(cf. PredefinedRecord in TdwsUnitTests)

Eric Grange
  • 5,931
  • 1
  • 39
  • 61
  • The function parameters are also included in these variables? – FHannes Mar 27 '13 at 09:33
  • Yes, functions parameters are seen as variable, as are Result & Self (when applicable). You've got shortcut methods & properties for Result & Self, but you don't have to use them. – Eric Grange Mar 28 '13 at 08:37