What are application events and how can they be controlled from SVB?

An event is an action that is typically performed by a user, such as clicking a mouse button, pressing a key, changing data, or opening a spreadsheet or workbook. In STATISTICA certain events are visible to the outside world, i.e., accessible to STATISTICA Visual Basic, and they can be used to customize its behavior. Using programmable events you can tailor the program's behavior to the users' needs. Examples of events applications might include:

  • building auditing systems into STATISTICA (by IT departments),

  • building interactive demonstration programs based on workbooks,

  • building customized user interfaces adhering to specific requirements of a particular application (or a specific company, e.g., to meet specific security requirements).

Events are an important part of the set of tools built into STATISTICA to make it a powerful solution building system.

There are three basic types of events: those pertaining to STATISTICA documents (e.g., spreadsheets), those pertaining to the STATISTICA application as a whole (e.g., opening a spreadsheet), and those pertaining to specific analyses (e.g., Basic Statistics, or 2D Scatterplots).

Document-level events. These events occur for open documents and in some cases, for objects within them. For example, the workbook document object can respond to the Open, New, and Print events; the spreadsheet document can respond to events such as changed data values, or double-clicking on a cell.

Application-level events. These events occur at the level of the application itself, for example, when a new report, graph, or workbook is created. You can create an event handler customizing these actions for all documents.

Analysis-level events. These events occur at the level of a specific analysis, for example, when you close an analysis using the Basic Statistics methods, or before an analysis sends results to a spreadsheet or graph. Note that the term "analysis" in STATISTICA denotes one task selected either from the Statistics, Data Mining, or Graphs menus, which can be very small and simple (e.g., one scatterplot requested from the Graphs menu) or very elaborate (e.g., a complex structural equation modeling analysis selected by choosing that option from the Statistics menu and involving hundreds of output documents). A typical application using analysis-level events would be to implement custom handling of output, for example, to send all graphs and results spreadsheets to another application.  

A simple example. Here is a very simple example of how a STATISTICA Visual Basic program can be connected to the application-level event of starting a new analysis. (Note: This example is performed using the classic menus, not the ribbon bar.) Start by selecting View code from the Tools - Macro - Application events menu. A Visual Basic editor will open; in the Object box of that editor, select Document, and then select AnalysisNew in the Proc box. Enter the simple MsgBox instruction as shown below.

Next select Autorun from the Tools - Macro - Application events menu and close the program editor. Every time that you start a new analysis (e.g., select Basic Statistics from the Statistics menu), the message You are starting a new analysis will be displayed. In fact, you can now exit the program, respond Yes when prompted to save the documents events, and the next time that you start STATISTICA and select an analysis, the message will be displayed. To turn off this program, deselect Autorun from the Tools - Macro - Application events menu.