2 Replies Latest reply on Apr 16, 2012 11:25 AM by T13856

    Opening a PDI within a PIW, unable to modify


      I have managed to open the display, insert a trend onto the display and then close the display. Seemingly working as it should, however when i double click on that entry to view the display the trend is not there, it just opens up a blank display. This is my code.


      app.ProcBooks.Open(oBook.Path & "!" & oEntry.Label)


                                 Dim PBDisplay As PBObjLib.Display = app.ActiveDisplay






      where the sub plottrend adds a trend to the display and changes the background of the display to white. Neither of these changes are picked up when i open up that entry. Should i be doing the SaveAs outside of the close method?

        • Re: Opening a PDI within a PIW, unable to modify

          Tom, not sure what happens, your code works for me. However, you should do a PBDisplay.Close(True):

              Private Sub OpenPIW2Display()
                  Dim oBook As PBObjLib.ProcBook
                  Dim oEntry As PBObjLib.Entry
                  Dim directory As String
                  directory = "C:\Book1.piw"
                  oBook = app.ActiveProcBook
                  ' Book1.PIW contains a single entry:
                  ' a link to an empty PDI display
                  oEntry = oBook.Entries.Item(1)
                  app.ProcBooks.Open(oBook.Path & "!" & oEntry.Label)
                  Dim PBDisplay As PBObjLib.Display = app.ActiveDisplay
              End Sub
              Private Sub plottrend(tagname As String)
                  Dim PBDisplay As PBObjLib.Display = app.ActiveDisplay
                  Dim PBTrend As PBSymLib.Trend = CType(PBDisplay.Symbols.Add(PBObjLib.pbSYMBOLTYPE.pbSymbolTrend), PBSymLib.Trend)
                  PBDisplay.BackgroundColor = &HFFFFFF
              End Sub