1 Reply Latest reply on Mar 27, 2014 6:24 PM by mhamel

    PI ActiveView - Dynamically Change Context of Element Relative Display

    alongecj

      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>
      

       

        • Re: PI ActiveView - Dynamically Change Context of Element Relative Display
          mhamel

          The Display ContextHandlers supports the same methods and properties as the Application.ContextHandlers property. The difference is that Display.ContextHandlers Property contains only those ContextHandlers that are currently used by a display.

           

          From what you are reporting, I would think that the context information belongs at the application level and not the display. This could explain why it fails. Try to get the ContextHandlers from the application object and see what is the result.