Proclarity SDK - delphi COM add in RRS feed

  • Question




    I am new to Proclarity development (and somewhat new to COM in this context).  I am using Delphi to make an add in (basically i want to do a "hello world" as a starting point) and am running into some problems...


    do you have any examples using delphi?


    I get a "invalid type typecast error" when proclarity starts after installing my COM dll and setting up the registry and I'm not sure what the problem is...


    also, I am having a hard time muddling through the signature of the methods and the utilization of the IApplication object and the menu drop down event etc. for adding the entry to the Tools Menu...


    any help would be great...

    Tuesday, April 29, 2008 10:09 PM


  • I don't have a sample in Delphi, but I'll post a VB sample.  This is for a class file that acts as a COM add-in for ProClarity Pro.  I hope this helps a bit.


    Code Snippet

    Option Explicit

    Implements IKExtensibility

    Private WithEvents moApp As Application

    'The following methods are entry points supported by COM add-ins.  If you are
    'developing a COM add-in, the methods and properties of the IKExtensibility
    'definition must implemented, or ProClarity will not recognize the COM add-in.
    'You can find a complete description of these methods and properties, including
    'the order in which they are invoked in the ProClarity SDK help file. Look in
    'the plug-in reference section for IKExtensibility.

    ' Occurs when the application begins its unload procedures so the COM add-in can
    ' save information before it is removed from the application
    Private Sub IKExtensibility_BeginShutdown()

    End Sub
    ' Loads and sets the COM add-in's options from the XML source document.  See
    ' the ProClarity SDK help file for important information on this method.
    Private Sub IKExtensibility_KPLoadOptions(SrcElement As Variant)

    End Sub
    ' Saves the COM add-in's options to the XML source document
    Private Sub IKExtensibility_KPSaveOptions(DestElement As Variant)

    End Sub

    ' Occurs when a COM add-in is connected to the app
    Private Sub IKExtensibility_OnConnect(ByVal Application As PCommonInterfaces.IApplication, Mode As Long)
        Set moApp = Application
    End Sub

    ' Occurs when the COM add-in is removed from the app
    Private Sub IKExtensibility_OnDisconnection(ByVal RemoveMode As Long)
        Set moApp = Nothing
     End Sub

    ' Occurs when the startup of the app is complete
    Private Sub IKExtensibility_OnStartupComplete()

    End Sub

    ' Returns the Class ID or unique identifier of the COM add-in
    Private Property Get IKExtensibility_KClassID() As String
        IKExtensibility_KClassID = "ZTestCom.clsCOM"
    End Property

    Private Sub moApp_OnGetDropDownMenu(ByVal Name As String, ByVal DropDownMenu As PPageCtrl.IKPMenuItems)
        Dim oMenuItem As IKPMenuItem
        ' Insert the new menu item within the tools menu.
        If Name = "Tools" Then
            Set oMenuItem = DropDownMenu.Add("Hello")
            With oMenuItem
                .Caption = "Hello, world!"
                Set .NotifyObject = Me
            End With
        End If
        Set oMenuItem = Nothing

    End Sub

    'This subroutine will be called when a menu item is selected.
    Public Sub KPExecuteMenuItem(MenuItem As IKPMenuItem)
        If MenuItem.Name = "Hello" Then


    MsgBox "Hello, World!"


       End If
    End Sub




    Tuesday, April 29, 2008 11:47 PM