Event Handler

 

Introduction

To be able to catch an event from RC-WinTrans, a VBA (Visual Basic for Applications) event handler class must be implemented.  An instance of this class must be created at run-time to enable the event handler.

 

RC-WinTrans can create a new macros file that contains an event handler class and enables the event handler at run-time.  See "Sample Event Handler," below.

 

For more information on events sent by RC-WinTrans please refer to the RC-WinTrans VBA Help.

 

 

Event Handler ("OnPressFunctionKey")

This event handler function is implemented by the template macros file for an RC-WinTrans event handler class.

 

' RC-WinTrans Event "OnPressFunctionKey"

' Called if a function key (1-24) has been pressed

 

Private Sub EventHandlerClass_OnPressFunctionKey  _

                                                              (ByVal FunctionKeyNumber As Long)

 On Error GoTo ErrHandler

 Dim Msg As String

 

 Msg = "Sample macro: Function key " & FunctionKeyNumber & " pressed"

 Call RCWinTrans.FlashInfo(Msg, False)

 

ErrHandler:

'    Error handling

End Sub

 

 

Sample Event Handler

For a sample implementation of a VBA event handler class used to create a new macros file with RC-WinTrans, open the Macros Files dialog box (Tools menu | Macros Files command) and select the template file "With module initializing procedures and event handler class."

 

The macros file that's created contains an event handler class which catches the RC-WinTrans event "OnPressFunctionKey."  The event handler is initialized automatically with a module-initializing function called "OnInitModule."  The event handler is active immediately after adding the macros file to RC-WinTrans.