6 Replies Latest reply on Sep 27, 2010 8:47 AM by AlistairFrith

    Programmatically displaying symbol definition dialogs


      I am writing a Processbook .Net addin that builds various aspects of a display. It needs to create some Value objects and get user input to set their properties. Is there a way to programmatically show the Value definition dialog for a specific value symbol? Or even independantly of any symbol?




      --- Alistair.



        • Re: Programmatically displaying symbol definition dialogs

          You can simulate it...


          Public Sub ShowItemDefinition(TheSymbol As Symbol)

          TheSymbol.Selected = True

          Dim cb As PBCommandBar
          Set cb = Application.CommandBars("Drawing Toolbar")
              Dim c As PBCommandBarControl
              Set c = cb.FindControl(, 32780) 'Selected Item

          End Sub


          (This is from my VBA archives, simple to convert to .Net)

          • Re: Programmatically displaying symbol definition dialogs

            Another way to do this (from my VBA archives) is to use SendKeys. You programmatically set ProcessBook to Run mode, select the symbol, and then use SendKeys to send an Enter command to bring up the definition window:


            ThisDisplay.Application.RunMode = False


            ThisDisplay.Symbols(sym).Selected = True


            SendKeys "~", False




            You can easily enough convert this to .Net using the My.Computer.Keyboard.SendKeys method.





              • Re: Programmatically displaying symbol definition dialogs



                Neither of those is particularly 'elegant' but would work. I have since found out though that for this particular item, I don't need to do it anyway. However, there are other areas (multistates) where I might still need something like this so I will probably end up using one of these methods somewhere.


                --- Alistair.



                  • Re: Programmatically displaying symbol definition dialogs

                    The only elegant way to do this would be for OSIsoft to modify the automation model for ProcessBook, possibly adding a "ShowDefinition" method to the Symbol object.

                      • Re: Programmatically displaying symbol definition dialogs

                        Good point - you guys presented 2 viable solutions, but there could be a more elegant way if we supported some sort of Symbol.ShowDefinition method. I suggest you contact Tech Support and file this in as an Enhancement Request for PI ProcessBook - they are really the ones to handle this kind of requests...

                          • Re: Programmatically displaying symbol definition dialogs

                            Don't think I ever got around to submitting this request so I have just done so.


                            I have found the Symbol.DefineMSProperties() method:

                            Symbol DefineMSProperties Method

                            Applies to


                            The DefineMSProperties method displays the Multi-State symbol dialog for the user to define the properties of the multi-state symbol.






                            Boolean. True if user pressed OK on the dialog box.


                            but when I call it on a child of a composite symbol, it immediately returns false without displaying the dialog. Has anybody got this one to work?


                            Actually, I have just found issue                          18577OSI8 on the Techsupport website:


                            VBA symbol method DefineMSProperties is not working

                            Customer Issue:  Customer was not able to set multistate properties of a symbol with the DefineMSProperties method in VBA.

                            Findings:    The bug was introduced in ProcessBook 3.0 when migrating from the PI API to the PI SDK.   The method call is not coded properly. 

                            Suggested Solution:  Properly code the DefineMSProperties method in ProcessBook.

                            Work Around:  Multistate properties of a symbol can be set in VBA by using the MultiState and MSState objects.  An example is provided.


                            So it looks like I will have to re-implement that dialog. Poo.


                            --- Alistair.