Creating a Statistica Add-In

In the Statistica type library, there is an interface called StatisticaAddIn, which you can view with the ObjectBrowser. To create an add-in, you must create and register a COM object server dll (dynamic link library) that exposes this interface, and, once the add-in is installed, Statistica will call the methods of the StatisticaAddIn interface at various times.  

In Statistica :

Ribbon bar. Select the Tools tab, click Macro and from the menu, select Add-Ins to display the Add-Ins dialog box.

In this dialog box, click the Add button to display the Specify Add-In to be Added dialog box. For Name, enter the PROGID of the COM CoClass of the add-in. The PROGID is a string that is associated with the CLSID in the registry; for example, the PROGID of the Statistica application is Statistica.Application. If the Auto Load check box is selected, Statistica will launch the add-in at startup.

To install an add-in programmatically, create the registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Statsoft\Statistica\AddIns\[Add-In ProgID]

and Statistica will automatically install the add-in for you the next time the program is launched. You can also specify if the add-in should be set to auto-load by setting a data DWORD value under this key named AutoLoad. Nonzero means the add-in will auto-load at startup, zero means the add-in will not auto-load. If the AutoLoad value is missing it defaults to true.

With an add-in, you can hook up event sinks to Statistica application and/or document events to respond to these events, use theStatistica object model to automatically create custom toolbars and menus, and set up command handler functions that will be called when menu commands or toolbar buttons are selected.

Interface

Following is a description of the methods of the interface:

Name

Called by Statistica to retrieve a user friendly add-in name for display.

Description

Called by Statistica to retrieve a user friendly add-in description for display.

Install

Called when the add in is installed or reinstalled.

UnInstall

Called when uninstalled or reinstalled.

AutoOpen

Called when AutoOpen is checked and Statistica is launching the add-in at start-up.

AutoClose

Called when add-in is being closed/shutdown.

CreateUI

Called after the add-in is installed the first time, when the add-in should create custom toolbars or menus and assign itself as the handler for them, if desired. See the Statistica.CommandBar and related interfaces. In Statistica.CommandBarItem.ConnectHandler you can pass a unique (unique within the particular add-in) integer ID of a button as the first parameter and the add-in interface object as the second. When that button is clicked or menu command selected, Statistica will call the add-in's OnCommand function and pass back the same integer ID.

DestroyUI

Add-in is being uninstalled and should remove all toolbars and menus that it created.

OnIdle

Called when the application is idle.

OnCommand

 If the add-in created toolbar buttons/menu commands and called CommandBarItem.ConnectHandler, this will be called when that item is selected by user.

OnUpdateCommandUI

If the add-in created toolbar buttons/menu commands and called CommandBarItem.ConnectHandler, this will be called when that item needs to be displayed; in this function the add-in can enable or disable the item.  You must set the output boolean parameter to True for the menu command or toolbar button to be enabled.