DADiSP Worksheet Functions > Function Categories > ActiveX > Automation Client > FIREEVENT
Fires a user defined event with a variable number of arguments.
FIREEVENT(eventID, arg1, arg2, …, argN)
eventID |
- |
An integer, the event number, a value between 1 and 8. |
argN |
- |
Any value. Zero or more values to pass to the event handler. |
An integer, a value > 0 if successful.
The following is an example of an event handler in VBA.
Public WithEvents DSP As DADiSPApp
‘’’ initialize server
Sub InitDSP()
Set DSP = New DADiSPApp
DSP.Visible = True
End Sub
''' handler for event 3
Sub DSP_Event03(ParamArray args() As Variant)
Dim i As Integer
Dim s As String
s = ""
For i = 0 To UBound(args)
s = s + CStr(args(i))
Next i
MsgBox s, vbOKOnly, "Event 3 Fired"
End Sub
To properly setup the event handler, add a Reference to the DADiSP Type Library.
In DADiSP, executing the statement:
fireevent(3)
causes the DSP_Event03 VBA code to execute and display a message box.
The statement:
fireevent(3, "test", 2.5)
causes the DSP_Event03 VBA code to execute and display the text:
test 2.5
Events fired by DADiSP can also be handled by DADiSP. Consider the following SPL event hander:
By establishing an internal connection, the event can be fired and handled:
The SPL function MyEvent is called and displays the text:
arg1: This is a test
FIREEVENT supports eight user events with EventID numbers 1 through 8.
Arguments are optional. The arguments are passed in the standard automation form as an array of variants compatible with most script and automation languages.
A Reference to the DADiSP Type Library must be specified for languages like VBA to properly parse the event function.
See RAISEEVENT to fire user events with a variable number of arguments passed as a SafeArray of variants suitable for .NET languages.
The following internal events are fired automatically:
Event Name |
EventID |
Arguments |
Description |
DataChanged |
100 |
String bstrIn |
Window value has changed, bstrIn contains the Window name |
EvaluationCompleted |
101 |
String bstrIn |
Window evaluation has completed, bstrIn contains the Window name |
NumWindowsChanged |
102 |
None |
Windows added or removed from a Worksheet |
WorksheetLoaded |
103 |
String bstrIn |
A Worksheet was loaded, bstrIn contains the Worksheet name |
FormulaChanged |
104 |
String bstrIn |
Window formula has changed, bstrIn contains the Window name |
LogText |
200 |
String bstrIn |
Text added to the logfile, bstrIn contains the new text |
StatusText |
201 |
String bstrIn |
Status line message, bstrIn contains the message text |
ErrorText |
202 |
String bstrIn |
Error message, bstrIn contains the error text. |