Document-Level Events Example
With document-level events, you can customize the behavior of open documents. Follow these step-by-step instructions to customize the current spreadsheet by changing the meaning of a double-click on a spreadsheet cell. In more technical terms, this example creates an event procedure for events in the Statistica Spreadsheet.
Procedure
The following code will be inserted in the Documents Events window:
Private Sub Document_BeforeDoubleClick _ (ByVal Flags As Long, _ ByVal VarNo As Long, _ ByVal CaseNo As Long, _ Cancel As Boolean)
End Sub
This code is a placeholder for the event code.
Result
As you can see, we have now "protected" the cells of the spreadsheet against the double-click event.
7) At this point, you may want to save the event handler (code) with the spreadsheet so that it will be run any time that spreadsheet is open. To do this, click on the Document Events window and select Save from the File menu. Now, close the Document Events window and activate the spreadsheet. Select Events - Autorun from the View menu. Finally, save the spreadsheet (option File - Save).
The next time you open the Exp.sta file, the new event handler will automatically be executed, and you will not be able to double-click on a cell in the spreadsheet. To "disconnect" the event handler, select again the View menu command Events - Autorun to clear that option.
See Graph Document-Level Events, Report Document-Level Events, Spreadsheet Document-Level Events, and Workbook Document-Level Events for listings of graph, report, spreadsheet, and workbook events, respectively.
See also, Macro Event Behavior.