Create an Event Procedure
You can add event procedures to any of the Reflection objects that support Automation events. Most of these objects appear in the Visual Basic Editor project pane (for example, IbmScreen or ThisScreen). For information about specific Reflection objects, see VBA Help from the Help menu.
To create an event procedure
- From Reflection 2008, open the Visual Basic Editor by clicking Tools > Visual Basic.
- In the Project Explorer window, expand the session project and then expand the Reflection Objects folder.
- Double-click the object for which you want to create an event procedure.
- In the upper-left corner of the Code window, from the Object list box, select the object name.
An event procedure is inserted into the Code window automatically.
- In the upper-right corner of the Code window, from the Procedures/Events list box, select the event procedure you want.
An empty event procedure is inserted in the Code window.
- In the procedure you just created, enter the code you want executed when the event occurs.
For example, the following code uses the BeforeSendControlKey event of the IbmScreen object to display a notification before sending a Control key:
Private Function IbmScreen_BeforeSendControlKey() If MsgBox("Send Control key?", vbOKCancel) = vbYes Then
IbmScreen_BeforeSendControlKey = True End If End Function
- Choose File > Save [session filename] to save the Automation event as part of the session document.
|