mjarvis

ProcessBook VB.NET Docking Window add-in in VB

Discussion created by mjarvis Employee on Feb 22, 2012
Latest reply on Feb 27, 2012 by andreas

Hey Guys,

 

I'm trying to build an add-in to processbook with a docking window. I found some sample code and templates to start with, now I'm having trouble displaying an active X control inside the docking window. I think the TryCast statements are not working well. The examples I'm looking at are done in C#, so its mainly a C# to VB conversion issue. The full project is attached, working on possibly getting the EventFrame add-in a head start.

 

 

 
        Public Sub OnConnection(ByVal Application As Object, ByVal ConnectMode As Extensibility.ext_ConnectMode, ByVal AddInInst As Object, ByRef custom As System.Array) Implements Extensibility.IDTExtensibility2.OnConnection
            Try
                app = CType(Application, PBObjLib.Application)
                m_dockWindow = app.DockWindows.Add(PBObjLib.pbDockWindowType.pbTypeSingleViewWindow, "Simple Window", PBObjLib.pbDockPosition.pbDockLeft, False)

                m_dockWindow.Visible = True
                m_dockWindow.Width = 250
                m_dockWindow.Title = "Visible Title"
                 m_dockWindow.Views.Add(PBObjLib.pbViewType.pbControlViewType, "EventFrameSearch")

                'MJAR trycast statements
                Dim MyView As PBView = m_dockWindow.Views.Item("EventFrameSearch")
                Dim MyPBControlView As PBControlView = TryCast(MyView, PBControlView)
                Dim labcntrl As System.Windows.Forms.Label = TryCast(MyPBControlView.CreateControl("Forms.Label.1"), System.Windows.Forms.Label)
                labcntrl.Text = "Label Control"

                 MsgBox("Hello World")
                'Dim MyView As PBView = m_dockWindow.Views.Item("EventFrameSearch")
                 ''MJAR trycast statements

                'Dim MyPBControlView As PBControlView = TryCast(MyView, PBControlView)
                ''MyPBControlView.CreateControl("Event.Frame")
                'Dim MyEventFrameTree As OSIsoft.AF.UI.AFViewControl
                'Dim MyPBControl As PBControl = MyPBControlView.CreateControl("Event.Frame")

             Catch ex As Exception
                MsgBox("Exception on Connection : " + ex.Message)
            End Try
        End Sub

 

Outcomes