The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



OnVarRequest


Unit: SDL_math2
Class: TMathExpression
Declaration: property OnVarRequest: TOnVarRequestEvent;
{ TOnVarRequestEvent = procedure (Sender: TObject; VarName: string; var Value: Variant; TkPos: integer) of object; }

The event OnVarRequest is triggered when the function parser of TMathExpression encounters a variable identifier. The parameter VarName contains the name of the variable and the parameter TkPos contains its position in the parsed expression. You have to supply the corresponding value by passing it in the parameter Value. If the variable name is not defined, you should return a NULL value (declared in Delphi unit Variants) in order to trigger an exception ("undefined variable").

Hint: If the event OnVarRequest is not assigned, any variable is assumed to be the default variant value (most often zero). This may lead to a confusing situation if, for example, a function is misspelled and thus interpreted as a variable name.



Last Update: 2016-Aug-15