dOPC Client Toolkit Help file
Example
var
  Group : TdOPCGroup;
  V3    : TdOPCItem;
begin
  Group := OPCServer.OPCGroups.Add('MyGroup');  //first add a group
  Group.DefaultItem.IsActive := false;          //override defaultvalue
  Group.OPCItems.AddItem('test.test.value1');   //adds a new Item to Group
  Group.OPCItems.AddItem('test.test.value2');
  V3 := Group.OPCItems.AddItem('test.test.value3');
  V3.IsActive := true;
end;
  
If you want to add more than one OPC item it is better
to use the methods BeginUpdate and EndUpdate of class TdOPCItems
or set parameter <later> of method AddItem to true.
The advantage of this method is that you can add OPC items to the
OPC server with only one COM/DCOM call. This has a performance advantage
against method above. Here an example:
  
procedure TForm1.Button1Click(Sender: TObject);
var
  Group : TdOPCGroup;
  V3    : TdOPCItem;
begin
  Group := OPCServer.OPCGroups.Add('MyGroup'); //first add a group
  
  Group.OPCItems.BeginUpdate;
  try
    Group.OPCItems.AddItem('test.test.value1'); //add a new Item to Group
    Group.OPCItems.AddItem('test.test.value2');
    //...
  finally
    Group.OPCItems.EndUpdate;
    Group.OPCItems.OPCAddAllItems;
  
  end;
end;
  
or
  
procedure TForm1.Button1Click(Sender: TObject);
var
  Group : TdOPCGroup;
  V3    : TdOPCItem;
begin
  Group := OPCServer.OPCGroups.Add('MyGroup'); //first add a group
  Group.OPCItems.AddItem('test.test.value1',true); //add a new Item to Group
  Group.OPCItems.AddItem('test.test.value2',true);
  Group.OPCItems.OPCAddAllItems;
end;
  
  
  
  
Copyright © 2001-2014 Kassl GmbH (http://www.kassl.de). All rights reserved.