alongecj

PI ActiveView - Dynamically Change Context of Element Relative Display

Discussion created by alongecj on Mar 6, 2014
Latest reply on Mar 27, 2014 by mhamel

Hi PI Gurus - We are trying the ActiveView product for use and we are trying to change the context of an element relative display programmatically.  Here is some sample code that loads a display and then changes a few parameters.  The script fails when I try to get information about the context.  Anyone have an example that they can share that obtains/changes the context of an ERD in ActiveView?  Many thanks!

 

 
<html>
<head>
  <title>PI ActiveView Test</title>
      <SCRIPT LANGUAGE = "VBScript">
           Sub Pbd1_ReadyStateChange(nReadyState)
               Const pbReadyStateLoading = 1
               Const pbReadyStateInteractive = 3
               Const pbReadyStateComplete = 4
               Dim ch, myContext
               If Pbd1.ReadyState = pbReadyStateComplete Then
                    Pbd1.Display.BackgroundColor = RGB(0,0,0)
                    Pbd1.Display.Trend1.TrendTitle = "Test Title Change"
                    Set ch = Pbd1.Display.ContextHandlers.Item("E")
                                myContext = ch.CurrentContext(Pbd1.Display) ' Fails Here
               End If
           End Sub
      </script>
</head>

<body>
<p>
<object ID      = "Pbd1"
        WIDTH   = "100%"
        HEIGHT  = "100%"
        CLASSID = "CLSID:4F26B906-2854-11D1-9597-00A0C931BFC8">
     <param name = "DisplayUrl" value = "file:///G:/EMSV_Phase1_PI/ER1.pdi"/> 
</object>
</p>
</body>
</html>

 

Outcomes