Table of Contents

TatCustomScripter.UsesObject Method

Makes the methods and properties of AObject accessible directly from all scripts without an object name prefix.

Remarks

UsesObject makes methods and properties of AObject to be accessible directly from script. In other words, the methods of the object behave as regular procedures, and properties as global variables. For example, if you have the object MyObj for the class TMyClass and that class is registered in scripter with method MyMethod and property MyProperty. If you call

UsesObject(MyObj);

then you will be able to use MyMethod and MyProperty directly from script as if they were global.

//Script MyProperty := SomeValue; MyMethod(Param1);

Alternatively you can specify the name of object using AName. In this case, you can optionally also use the name of object as if it were a regular object. Using methods and properties directly still works. See following example.

UsesObject(MyObj, 'MyObj'); //Script MyObj.MyProperty := SomeValue; MyObj.MyMethod(Param1); MyProperty := SomeValue; MyMethod(Param1);

Just like any other object in scripter, only published properties will be accessible, unless you previously register the class of the object and register its methods and properties. Do not use AClassName parameter, it's for internal use.

Syntax

Unit: atScript

function TatCustomScripter.UsesObject(AObject: TObject; AName: string; AClassName: string): TatClass;

Parameters

<-> Parameter Type Description
AObject TObject
AName string
AClassName string

See also