FHannes
FHannes

Reputation: 782

Retrieving record parameters from TProgramInfo in DWScript

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.

Upvotes: 1

Views: 217

Answers (1)

Eric Grange
Eric Grange

Reputation: 6211

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)

Upvotes: 2

Related Questions