After adding a reference to the IBBPlugIn interface in the General Declarations section of your plug-in class, you need to fill in each of the plug-in properties and events. The properties provide information to the host, such as the name and description of the plug-in.

The steps below take you through setting up a simple plug-in class.

Add the interface reference.

Implements IBBPlugIn  

'A session context for the application is passed in when the  

'  plug-in is initialized (IBBPlugIN_OnInit()).  This may not  

'  be necessary, depending on the application

Private moSessionContext As IBBSessionContext

 

'When the Plug-In is loaded (IBBPlugIn_OnLoad()), the main  

'  user interface document is passed in.  This may not be  

'  necessary, depending on the application

Private moUserDoc As Object



Set any initialization information. Note that when a plug-in is first accessed, The Raiser’s Edge host needs to perform several initialization tasks before the plug-in can load. This requires that the OnInit and OnCloseDown events fire. Therefore, the OnInit and OnClosedown events cannot be used to determine whether or not the plug-in has been run. You should avoid putting code into these events, with the exception of setting a reference to the SessionContext in OnInit, and clearing the reference in OnCloseDOwn. OnLoad and OnQueryUnLoad do not fire during the initialization process and can be used for any required start-up and closedown code.

Private Sub IBBPlugIn_OnInit(oREHost As BBInterfaces.IBBShellHost)

   Set moSessionContext = oREHost.SessionContext

End Sub 
    

Private Sub IBBPlugIn_OnLoad(oDoc As Object) 'User Object

   Set moUserDoc = oDoc

End Sub



Specify the name of the plug-in UI document. The IBBPlugIn_DocumentName() property should return the path to the UI file. If you are using user documents for your interface, when you create the DLL, each user document is in the same directory as the DLL with the extension *.vbd.

'Uses App.Path to return the path of the RE7 application,  

'   and adds the PlugIns path and file name.

Private Property Get IBBPlugIn_DocumentName() As String

   IBBPlugIn_DocumentName = App.Path & "\PlugIns\docMyPlugIn.vbd"

End Property 
 

Private Property Get IBBPlugIn_DocumentType() As BBREAPI7.REShellDocumentTypes

   'Specify the type of document (HTML or ACTIVEX)

   '  - this property is reserved for future use and is not currently used

   IBBPlugIn_DocumentType = redocActiveXDocument

End Property




Create a user-friendly description for your plug-in. The text displays on the Plug-Ins page in the The Raiser’s Edge.

Private Function IBBPlugIn_PluginName() As String

   IBBPlugIn_PluginName = "My Plug-In"

End Function

 

Private Function IBBPlugIn_PluginDescription() As String

   IBBPlugIn_PluginDescription = "Sample RE7 Plug-In"

End Function





Create a caption for your plug-in and add a graphic, if necessary. This appears at the top of the Plug-Ins page in the The Raiser’s Edge. Plug-in header images are 32 x 32 pixels and can be *.jpg, *.gif, or *.bmp format.

Private Property Get IBBPlugIn_HeaderCaption() As String

   IBBPlugIn_HeaderCaption = "My Plug-in Header Caption"

End Property

 

Private Property Get IBBPlugIn_HeaderImage() As String

   IBBPlugIn_HeaderImage = App.Path & "\PlugIns\MyPlugIn.jpg"

End Property



Close down the plug-in properly. The IBBPlugIn_OnQueryUnload() occurs before the plug-in or application closes. Note that linking to a separate HTML page from the shell or switching to another shell menu item causes this event to fire. OnQUeryUnload allows you to verify information and cancel the close process if the end-user has not completed all necessary tasks. Setting bCancel to true cancels the unload and returns the end-user to the plug-in form. bShellIsUnloading is true if the end-user is trying to close The Raiser’s Edge.

Private Sub IBBPlugIn_OnQueryUnload(bCancel As Boolean, _

               ByVal bShellIsUnloading As Boolean)

 

   'AllowClose is a public method on the docMyPlugIn user  

   '  document.  The routine validates the user input  

   '  and determines if the plug-in can be closed.

   If Not moUserDoc.AllowClose Then

       MsgBox "Required field missing."

       bCancel = True

   End If

 

End Sub



Private Sub IBBPlugIn_OnClosedown()

   If Not moUserDoc Is Nothing Then

       Set moUserDoc = Nothing

   End If 
    

   If Not moSessionContext Is Nothing Then

       Set moContext = Nothing

   End If

End Sub

Disclaimer: We provide programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes you are familiar with Microsoft Visual Basic and the tools used to create and debug procedures. Our Customer Support can help explain the functionality of a particular procedure, but we will not modify, or assist you with modifying, these examples to provide additional functionality. If you are interested in learning more about the VBA and API modules, contact your account manager.