GenerateEvent method (WinStudio scripts)
Applies To
IWSForm interface
Definition
Generates a standard event or a customized event for a specified form.
Syntax
object.GenerateEvent( string )
Part | Description |
object | Required. A reference to a valid form object. |
string | Required. The name of the event. |
Examples
Sub Main() Dim iReturn As Integer ' Generate an event which refreshes the Form data iReturn = ThisForm.GenerateEvent("StdFormRefresh") Application.ShowMessage( "Refresh Complete" ) End sub
In this example, parameter 1 is the name of a component object, which indicates whether or not a record has been selected, and parameter 2 is the name of an event to be generated. The script loops through the IDO collection and generates an event for each selected record.
Sub Main() On Error GoTo ErrorHandler Application.DiagnosticsLog("entering script") Dim CurrentObjectIndexSave As Integer Dim ReturnValue As Integer Dim SelectFlagName As String Dim SelectFlagValue As String Dim strEvent As String ReturnValue = 1 CurrentObjectIndexSave = ThisForm.PrimaryIDOCollection.GetCurrentObjectIndex() SelectFlagName = GetParameter(0) strEvent = GetParameter(1) For i As Integer = 0 To ThisForm.PrimaryIDOCollection.GetNumEntries - 1 SelectFlagValue = ThisForm.PrimaryIDOCollection.GetObjectProperty(SelectFlagName, i) Application.DiagnosticsLog("i=" & i) Application.DiagnosticsLog("SelectFlagValue=" & SelectFlagValue) If SelectFlagValue = "1" Then ThisForm.PrimaryIDOCollection.SetCurrentObject(i) ThisForm.GenerateEvent(strEvent) End If Next ThisForm.PrimaryIDOCollection.SetCurrentObject(CurrentObjectIndexSave) GoTo NormalExit NormalExit: Application.DiagnosticsLog("exiting script normally") ReturnValue = 0 Exit Sub ErrorExit: Application.DiagnosticsLog("exiting script via ErrorExit") ReturnValue = 1 Exit Sub ErrorHandler: Application.ShowMessage(Err.Description) ReturnValue = 1 End Sub