TiVCLComponent.OnBeforeNewOPCData

TiVCLComponent See Also

Occurs before data from an attached OPC server is sent to the control.

type TBeforeOPCNewDataEvent = procedure(Index: Integer; var Data: OleVariant) of object;

property OnBeforeNewOPCData : TBeforeOPCNewDataEvent;

Description

Use OnBeforeNewOPCData to give yourself the opportunity to modify OPC data before it is sent to the control.

The OnBeforeNewOPCData event will fire everytime OPC data is received by the component, regardless or whether the data is different than previously received values.

Example:

procedure TForm1.iComponent1BeforeNewOPCData(Index: Integer; var Data: OleVariant);

begin

//Convert Incoming Data To TDateTime Value (Double Value).

//Useful for converting "12:00:00 09/01/2002" for those components

//requiring a Date/Time value in Double format or in situations where

//you want to modify or scale incoming data.

Data := StrToDateTime(Data);

end;

Note: for the Plot Pack components, the Index refers to the Channel Index. For all other components, the Index refers to the OPC Item that has been added to the control.

Contents | Index | Previous | Next