dOPC Client Toolkit Help file
TdOPCPropertyBrowser Class
dOPC.TdOPCPropertyBrowser
C++
public: class TdOPCPropertyBrowser : public TComponent;
C#
public class TdOPCPropertyBrowser : TComponent;
Visual Basic
Public Class TdOPCPropertyBrowser
Inherits TComponent

dOPC

class to browse for properties of given items 

TdOPCPropertyBrowser can be used to browse the available properties (also referred to as attributes or parameters) of one or more TdOPCItem objects and to read the current values of these properties.

procedure TForm1.Button1Click(Sender: TObject);
var
  PB   : TdOPCPropertyBrowser;
  P    : TdOPCItemProperty;
begin
  PB := TdOPCPropertyBrowser.create(nil); //create property browser
  try
    PB.OPCServer := dOPCServer1; //set server
    PB.AddItem('Random.Int4'); //add one item more are possible
    PB.AddProperty(OPC_PROP_CDT); //add property data type
    PB.AddProperty(OPC_PROP_DESC); //add property description
    PB.Execute; //get properties for item from opc server

    P := PB[0].ById(OPC_PROP_CDT); //get property data type
    if P <> nil then //if property exists
      lDataType.Caption := VarToAStr(P.Value); //show value

    P := PB[0].ById(OPC_PROP_DESC); //get property description
    if P <> nil then //if property exists
      lNote.Caption := VarToAStr(P.Value); //show value
  finally
    PB.Free;
  end;
end;
TdOPCPropertyBrowser Methods 
Description 
AddItems adds an item with the passed ItemId to Props and returns the TdOPCItemProperties of this item. 
AddProperty adds a the property with the passed PropertyId to an internal list. 
ByName returns the TdOPCItemProperties of an item with the passed ItemId. 
Clear deletes all items and properties from the lists that have been previously added by AddItem and AddProperty
Execute starts browsing the properties. 
GetProperty returns a TdOPCItemProperty object for the item with the passed ItemId and the passed PropId. 
ItemErrorID returns the error Id (if existent) of the item with the passed ItemId. 
TdOPCPropertyBrowser Properties 
Description 
Count contains the number of items in the list. 
OPCServer contains the TdOPCServer you want to use with the TdOPCPropertyBrowser class. 
Props contains the TdOPCItemProperties objects which can be accessed via the Index parameter. 
If Values is True, property values will be returned from TdOPCServer
What do you think about this topic? Send feedback!
Copyright © 2001-2014 Kassl GmbH (http://www.kassl.de). All rights reserved.