TScriptExternal Variables |
||||
Homepage TScript External Variables |
Global Variables and ConstantsGlobal variables and constants are valid in all scripts you compile. Assumed you're using color constants in all of your scripts: const red = $FF0000; In this case it's advisable to use global constants instead of adding the constant declarations above to each script. Add the following lines to the initialization section of your Delphi form: script1.setGlobalConst ('red',
$FF0000); Global Variables can be used to transfer data from one script to another. You could store information about the environment in global variables. Finding Variables and ConstantsYou can find variables and constants by specifying their name or by a numerical index. The following functions all return a TDataItem object in success. GetGlobal (nam :
string) : TDataItem; GetGlobalIndex (i :
Integer) : TDataItem; GetVar (nam : string)
: TDataItem; GetVarIndex (i :
Integer) : TDataItem; Deleting Global Variables and ConstantsDeleteGlobal (nam :
string); DeleteGlobals; The Method SetVarTo create variables in OnEval events use the method SetVar of the TScript component. It only makes sense to call this method if a script is running. |