Table of Contents

TatClass.DefineProp Method

Registers a new property in the class. You don't need to register published properties since they are imported automatically by Delphi scripter.

Syntax

Unit: atScript

function TatClass.DefineProp(AName: string; ADataType: TatTypeKind; AGetter: TMachineProc; ASetter: TMachineProc; APropertyClass: TClass = nil; AIsClassProp: Boolean = False; AIndexCount: Integer = 0): TatProperty;

Parameters

<-> Parameter Type Description
AName string The name by which the property will be accessible from script.
ADataType TatTypeKind The data type of the property.
AGetter TMachineProc The method wrapper which will be called by the script when the property is read from script. Those are the methods that should actually read or write the real Delphi property.
ASetter TMachineProc The method wrapper which will be called by the script when the property is written from script. Those are the methods that should actually read or write the real Delphi property.
APropertyClass TClass Optional: Default value is nil

If ADataType is tkClass, then APropertyClass must contain the class of the property (TFont, for example). Otherwise, PropertyClass must be nil.
AIsClassProp Boolean Optional: Default value is False

Indicates if the property is a regular property (accessible from object instance) or a class property.
AIndexCount Integer Optional: Default value is 0

If the registered property is an indexed property, then AIndexCount must contain the number of dimensions of the property.
The function will return the newly created TatProperty.
If a property with the name AName already exists in the class, nothing is created, and the function will return the existing TatProperty object.

See also