1 Reply Latest reply on Feb 21, 2013 5:44 AM by hanyong

    How would I call a ProcessBook button from a C# add-in?

    Andrew Pong

      I have a button that is in a ProcessBook display, and I've written an add-in that is able to modify the display's text. However, I'm trying to get the add-in to call a button that is on the display.

       

       

       

      How would I do this?

        • Re: How would I call a ProcessBook button from a C# add-in?
          hanyong

          Hi Andrew,

           

          You can access Symbols from an active display using something like 

           
          Symbol sym = this.app.ActiveDisplay.Symbols.Item("Button1");
          
          // above assume that you have reference to ProcessBook Application object (PBObjLib.Application)
          
          // and we are getting reference to the Button symbol by name
          if (sym != null)
          {
              if (sym.Type == (int)PBSymLib.pbSYMBOLTYPE.pbSymbolButton)
              {
                  PBSymLib.Button btn = (PBSymLib.Button)sym;
                  PBSymLib.ButtonDefinition btnDef = btn.GetDefinition();
                  string buttonText = btnDef.Text;
                  
                  // code for what you want to do with the button information
              }
          }
          

           My code is assuming that the add-in already has a reference to an PBObjLib.Application object that represents the ProcessBook application that is loading the add-in. Through it, you can get reference to the active display and the symbols inside the display.