3 Replies Latest reply on Mar 11, 2011 3:54 PM by dhollebeek

    Hiding a trend automatically

    cjrancur

      I have ProcBook displays that have several small thumbnail trends per each display.  Each of these trend objects has two PI tags displayed.  The first trace pen for each thumbnail is the deviation from setpoint, and the second pen is the actual process variable (PV). The deviation is the key parameter being trended, and the process variable is available for additional information.

       

      Operators have asked if there is a way to provide a button that would hide the second pen on all of the thumbnail trends at the click of a button.  They asked for that after I showed them how to do it by clicking on the pen on a single thumbnail trend.  They would like to avoid clicking 20 times for 20 thumbnail trends, and I can understand that.

       

      I've been trying, but I'm having these three problems. 

       

      1) I can't find the object or the method anywhere in vba, for hiding a selected pen.  I'm trying to duplicate clicking on a tag at the right hand side of a ProcBook trend, to make the trend hide. Is there an SDK or ProcBook vba method for this?  I am using PB 3.2.0.0.  I know how to delete the trace entirely, so I am starting to build it that way.  It's not elegant, it's a resource hog, and it's probably not the easy way to do this.

       

      2) How can I assign a vba macro to a command button in ProcBook? I've done this before, but now I can't right click to get the "assign macro" dialog on a Microsoft Form2 CommandButton, so I don't know how to make the command button work.   I tried the PB button, but it asks for a directory somewhere, and when I type the vba macro's public subroutine name in the action field, nothing happens.  

       

      3)This last issue is driving me batty.  I typed "Dim test as boolea", and received a compile error, because the compiler did not know "boolea" .  This error dialog locked me out for 10 minutes, so I could not complete the statement with the missing "n" on "boolea".  I banged my fist on my desk a few times, to no avail.  When I managed to escape after clicking OK and Ctrl-Pause several times, then I had only a second before the dialog box came back again.  I tried several times before I finally punched my keyboard fast enough to beat the automatic dialog. I'm working around this by commenting any new code before I enter it.  Surely there's an easier way.  I don't remember having this trouble in the past. I am coding while in a vba debugger break. Can ProcBook programming be done outside of the display now, by using vb.net  or using a vba module that is not held within the same PB display?

       

      Carrie

        • Re: Hiding a trend automatically
          andreas

          Hi Carrie,

           

          1) Hide the second trace from all trends:

           
              Dim MySymbol As Symbol
              Dim MyTrend As Trend
              For Each MySymbol In Symbols
                  If MySymbol.Type = pbSymbolTrend Then
                      Set MyTrend = MySymbol
                      If MyTrend.TraceCount > 1 Then
                          MyTrend.CurrentTrace = 2
                          MyTrend.ShowTrace = False
                      End If
                  End If
              Next
          

           

           

          2) you do not assign a macro. in the VBA editor, above the source code for ThisDisplay, you see two drop down boxes. The left for the object (CommandButtonX) and the right on for the event (Click)

           

          3) in the Visual Basic Toolbar:

           

          2845.Clipboard01.jpg

           

          Hope this helps,