Creating a Pen via Scripts

<< Click to Display Table of Contents >>

 

Creating a Pen via Scripts

The following example shows how to create a Pen via script, according to the following procedures.

1.Create an E3Chart on a Screen.

2.Create a Command Button on this Screen. In its Caption property, type "Create Pen".

3.Open this Command Button's Properties Window and select the Scripts tab. Type the next script on its Click event.

Sub Text1_Click()
  Set E3Chart1 = Screen.Item("E3Chart1")
  MsgBox "Click OK to create a Pen"
  Set Pen = E3Chart1.Pens.AddPen("Pen1")
  Pen.DataSourceType = 0 ' Real-time
  Pen.VerDataSource = "Data.DemoTag1"
  Pen.UseTimeStamp = True ' At x uses timestamp
  Pen.Color = RGB(255, 0, 0)
  Pen.DocString = "test"
  MsgBox "Click OK to connect"
  Pen.Connect() ' Starts retrieving data
  MsgBox "Click OK to fit"
  E3Chart1.FitPen(0)
  MsgBox "Click OK to disconnect"
  Pen.Disconnect() ' Stops retrieving data
  MsgBox "Click OK to remove this Pen"
  E3Chart1.Pens.Remove(Pen.Name)
End Sub

 

4.Execute this project and check its results.

Was this page useful?