7 Replies Latest reply on Oct 14, 2016 7:09 PM by gregor

    PI Process Book.   Creating "Action Routines" in VBA for Grouped Symbols


      PI Process Book.

      I have made up a grouped object from rectangles and labels and now want act on “click” events it might generate at run time using VBA.
      The property “Enabled” is True for the object so the Programmer Reference help implies that this is possible.

      The “EnableScript” property is False.  


      Do I have to create a Class Module specifically for this symbol?
      If so how? 


      Just sticking a subroutine called “<SymbolName>_Click()” in the code or the Display
      Module does not do it.


      Thanks in advance.

        • Re: PI Process Book.   Creating "Action Routines" in VBA for Grouped Symbols

          Hello Nigel,


          Are you using ActiveX controls? If so, which one?

          If you are using standard ProcessBook controls like Rectangle and Text, there shouldn't be an Enabled property. Please confirm. For standard ProcessBook controls, Enable Scripting must be set to True to access objects from within VBA.


          I just tested and grouping objects makes Enable Scripting property inaccessible. Also, with grouping a new object of type Composite is created. As far as I can see you don't have programmatic access to Composite types.  


          You can specify code for the OnClick() method for each object individually.

            • Re: PI Process Book.   Creating "Action Routines" in VBA for Grouped Symbols

              Hello Gregor




              Thank you for your help.




              No I am not using ActiveX controls.




              The initial box that I create is a standard process Book Control, i.e. a Rectangle and then I am placing other Rectangles and Text Labels inside this.  When this assembly is complete it is then grouped so as you say in your reply it becomes a Composite type.  The EnableScript field appears as False when you examine it but again as you say attempting to set it True is not accepted.




              The Enabled property I can set toggle between True and  False but according to the Programmer Help this just effects response to Before Click events so I should get normal single Click events.


              In the last line your email confirms I should be able to explicitly code an “OnClick()” method for the objects I am creating, but I have been trying again and it is not working for me.  I am creating routines called “SubModel1_Click(ByVal varX As Long, ByVal varY As Long)” where “SubModel1” is the name of the Grouped/Composite display symbol.    I have tried making them both Public and Private so I suspect the problem is that I am either placing the code in the wrong place or need to create a dedicated Class Module that I do not have.




              Best Regards


              Rob Ferguson


              UKM : +44 (0)7767 317486


              UK : +44 (0)1330 830038