%PDF- %PDF-
Direktori : /usr/lib/libreoffice/share/basic/SFDialogs/ |
Current File : //usr/lib/libreoffice/share/basic/SFDialogs/SF_DialogListener.xba |
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> <script:module xmlns:script="http://openoffice.org/2000/script" script:name="SF_DialogListener" script:language="StarBasic" script:moduleType="normal">REM ======================================================================================================================= REM === The ScriptForge library and its associated libraries are part of the LibreOffice project. === REM === The SFDialogs library is one of the associated libraries. === REM === Full documentation is available on https://help.libreoffice.org/ === REM ======================================================================================================================= Option Compatible Option Explicit ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''' SF_Listener ''' =========== ''' The current module is dedicated to the management of dialog control events, triggered by user actions, ''' which are not defined with the Basic IDE ''' ''' Concerned events: ''' TreeControl control type, prefix = _SFEXP_ ''' ----------- ''' The OnNodeSelected event, triggered when a user selects a node ''' A typical action is to display additional info about the selected item elsewhere in the dialog ''' The OnNodeExpanded event, triggered when a user clicks on the expansion symbol ''' A typical action is to create dynamically a subnode or a subtree below the expanded item ''' ''' PageManager facility, prefix = _SFTAB_ ''' ----------- ''' Depending on the piloting control(s), next event types are implemented ''' XActionListener: for buttons ''' XItemListener: for listboxes, comboboxes and radio buttons ''' ''' The described events are processed thru UNO listeners ''' ''' "On" events defined by code, prefix = _SFFOCUS_, _SFKEY_, _SFMOUSE_, _SFMOVE_, _SFITEM_, _SFADJUST_, _SFTEXT_ ''' ----------- ''' All event types applicable on dialogs and control types <> TreeControl ''' The events MUST NOT be preset in the Basic IDE ''' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' REM ================================================================= DEFINITIONS REM ================================================================== EXCEPTIONS REM ================================================ PUBLIC METHODS (TREECONTROL) REM ----------------------------------------------------------------------------- Public Sub _SFEXP_requestChildNodes(Optional ByRef poEvent As Object) ''' Triggered by the OnNodeExpanded event of a tree control ''' The event is triggered thru a com.sun.star.view.XTreeExpansionListener ''' The argument is passed to a user routine stored in the SF_DialogControl instance ''' as a scripting framework URI Dim oControl As Object ' The SF_DialogControl object having triggered the event On Local Error GoTo Catch ' Avoid stopping event scripts Check: ' Ensure there is a node If IsNull(poEvent) Or IsMissing(poEvent) Then Exit Sub If IsNull(poEvent.Node) Then Exit Sub Try: Set oControl = ScriptForge.SF_Services.CreateScriptService("SFDialogs.DialogEvent", poEvent) ScriptForge.SF_Session._ExecuteScript(oControl.OnNodeExpanded, poEvent) Finally: Exit Sub Catch: GoTo Finally End Sub ' SFDialogs.SF_Dialoglistener._SFEXP_requestChildNodes Sub _SFEXP_disposing(ByRef poEvent As Object) End Sub Sub _SFEXP_treeExpanding(Optional ByRef poEvent As Object) End Sub Sub _SFEXP_treeCollapsing(ByRef poEvent As Object) End Sub Sub _SFEXP_treeExpanded(ByRef poEvent As Object) End Sub Sub _SFEXP_treeCollapsed(ByRef poEvent As Object) End Sub REM ----------------------------------------------------------------------------- Public Sub _SFSEL_selectionChanged(Optional ByRef poEvent As Object) ''' Triggered by the OnNodeSelected event of a tree control ''' The event is triggered thru a com.sun.star.view.XSelectionChangeListener ''' The argument is passed to a user routine stored in the SF_DialogControl instance ''' as a scripting framework URI ''' ''' Nothing happens if there are several selected nodes or none Dim vSelection As Variant ' Variant, not object !! Dim oControl As Object ' The SF_DialogControl object having triggered the event On Local Error GoTo Catch ' Avoid stopping event scripts Check: ' Ensure there is a selection If IsNull(poEvent) Or IsMissing(poEvent) Then Exit Sub vSelection = poEvent.Source.getSelection() If IsEmpty(vSelection) Or IsArray(vSelection) Then Exit Sub Try: Set oControl = ScriptForge.SF_Services.CreateScriptService("SFDialogs.DialogEvent", poEvent) ScriptForge.SF_Session._ExecuteScript(oControl.OnNodeSelected, poEvent) Finally: Exit Sub Catch: GoTo Finally End Sub ' SFDialogs.SF_Dialoglistener._SFSEL_selectionChanged Sub _SFSEL_disposing(ByRef poEvent As Object) End Sub REM ============================================ PUBLIC METHODS (PAGE MANAGEMENT) REM ----------------------------------------------------------------------------- Public Sub _SFTAB_actionPerformed(Optional ByRef poEvent As Object) ''' Event triggered by a button configured through the dialog page manager ''' Buttons may be of type TABCONTROL, BACKCONTROL or NEXTCONTROL Dim oControl As Object ' The DialogControl instance having caused the event Dim sName As String ' Control name Dim oDialog As Object ' The parent Dialog instance Dim oPageManager As Object ' An entry in dialog._PageManagement Const TABCONTROL = 2 Const BACKCONTROL = 3 Const NEXTCONTROL = 4 Check: On Local Error GoTo Finally ' Never interrupt !! Set oControl = CreateScriptService("DialogEvent", poEvent) If IsNull(oControl) Then GoTo Finally Try: Set oDialog = oControl.Parent With oDialog sName = oControl.Name ' Find entry in page manager settings For Each oPageManager In ._PageManagement If oPageManager.ControlName = sName Then Select Case oPageManager.PageMgtType Case TABCONTROL : .Page = oPageManager.PageNumber Case BACKCONTROL : .Page = .Page - 1 Case NEXTCONTROL : .Page = .Page + 1 Case Else End Select Exit For End If Next oPageManager End With Finally: Exit Sub End Sub ' SFDialogs.SF_Dialoglistener._SFTAB_actionPerformed REM ----------------------------------------------------------------------------- Public Sub _SFTAB_itemStateChanged(Optional ByRef poEvent As Object) ''' Event triggered by a listbox, combobox or radiobutton configured through the dialog page manager ''' Buttons are of type PILOTCONTROL Dim oControl As Object ' The DialogControl instance having caused the event Dim sName As String ' Control name Dim oDialog As Object ' The parent Dialog instance Dim oPageManager As Object ' An entry in dialog._PageManagement Dim lPage As Long ' Actual page number Check: On Local Error GoTo Finally ' Never interrupt !! Set oControl = CreateScriptService("DialogEvent", poEvent) If IsNull(oControl) Then GoTo Finally Try: Set oDialog = oControl.Parent With oDialog sName = oControl.Name ' Find entry in page manager settings For Each oPageManager In ._PageManagement If oPageManager.ControlName = sName Then lPage = oPageManager.PageNumber If lPage = 0 Then .Page = oControl.ListIndex + 1 Else .Page = lPage Exit For End If Next oPageManager End With Finally: Exit Sub End Sub ' SFDialogs.SF_Dialoglistener._SFTAB_itemStateChanged REM ----------------------------------------------------------------------------- Public Sub _SFTAB_disposing(Optional ByRef poEvent As Object) End Sub REM ========================== PUBLIC METHODS (GENERIC DIALOG AND CONTROL EVENTS) ''' Next methods SIMULATE the behaviour of events set on dialogs and dialog controls ''' in the Events tab of a dialog editing page in the Basic IDE. ''' They are not triggered by events preset in the Basic IDE. ''' They are triggered ONLY when the event has been set by code with one of the OnXxxYyyy properties, ''' like in: ''' dialog.OnActionPerformed = "vnd...." ' URI notation REM ----------------------------------------------------------------------------- Public Sub _SFACTION_actionPerformed(Optional ByRef poEvent As Object) ''' Triggered by the OnActionPerformed event in a dialog control ''' The event is triggered thru a com.sun.star.awt.XActionListener ''' The argument is passed to a user routine stored in the SF_DialogControl instance ''' as a scripting framework URI _TriggerEvent("actionPerformed", poEvent) End Sub ' SFDialogs.SF_Dialoglistener. _SFACTION_actionPerformed REM ----------------------------------------------------------------------------- Public Sub _SFACTION_disposing() End Sub REM ----------------------------------------------------------------------------- Public Sub _SFADJUST_adjustmentValueChanged(Optional ByRef poEvent As Object) ''' Triggered by the OnAdjustmentValueChanged event in a scrollbar ''' The event is triggered thru a com.sun.star.awt.XAdjustmentListener ''' The argument is passed to a user routine stored in the SF_DialogControl instance ''' as a scripting framework URI _TriggerEvent("adjustmentValueChanged", poEvent) End Sub ' SFDialogs.SF_Dialoglistener. _SFADJUST_adjustmentValueChanged REM ----------------------------------------------------------------------------- Public Sub _SFADJUST_disposing() End Sub REM ----------------------------------------------------------------------------- Public Sub _SFFOCUS_focusGained(Optional ByRef poEvent As Object) ''' Triggered by the OnFocusGained event in a dialog or dialog control ''' The event is triggered thru a com.sun.star.awt.XFocusListener ''' The argument is passed to a user routine stored in the SF_Dialog or SF_DialogControl instance ''' as a scripting framework URI _TriggerEvent("focusGained", poEvent) End Sub ' SFDialogs.SF_Dialoglistener._SFFOCUS_focusGained REM ----------------------------------------------------------------------------- Public Sub _SFFOCUS_focusLost(Optional ByRef poEvent As Object) ''' Triggered by the OnFocusLost event in a dialog or dialog control ''' The event is triggered thru a com.sun.star.awt.XFocusListener ''' The argument is passed to a user routine stored in the SF_Dialog or SF_DialogControl instance ''' as a scripting framework URI _TriggerEvent("focusLost", poEvent) End Sub ' SFDialogs.SF_Dialoglistener._SFFOCUS_focusLost REM ----------------------------------------------------------------------------- Public Sub _SFFOCUS_disposing() End Sub REM ----------------------------------------------------------------------------- Public Sub _SFITEM_itemStateChanged(Optional ByRef poEvent As Object) ''' Triggered by the OnItemStateChanged event in a dialog control ''' The event is triggered thru a com.sun.star.awt.XItemListener ''' The argument is passed to a user routine stored in the SF_DialogControl instance ''' as a scripting framework URI _TriggerEvent("itemStateChanged", poEvent) End Sub ' SFDialogs.SF_Dialoglistener. _SFACTION_actionPerformed REM ----------------------------------------------------------------------------- Public Sub _SFITEM_disposing() End Sub REM ----------------------------------------------------------------------------- Public Sub _SFKEY_keyPressed(Optional ByRef poEvent As Object) ''' Triggered by the OnKeyPressed event in a dialog or dialog control ''' The event is triggered thru a com.sun.star.awt.XKeyListener ''' The argument is passed to a user routine stored in the SF_Dialog or SF_DialogControl instance ''' as a scripting framework URI _TriggerEvent("keyPressed", poEvent) End Sub ' SFDialogs.SF_Dialoglistener._SFKEY_keyPressed REM ----------------------------------------------------------------------------- Public Sub _SFKEY_keyReleased(Optional ByRef poEvent As Object) ''' Triggered by the OnKeyReleased event in a dialog or dialog control ''' The event is triggered thru a com.sun.star.awt.XKeyListener ''' The argument is passed to a user routine stored in the SF_Dialog or SF_DialogControl instance ''' as a scripting framework URI _TriggerEvent("keyReleased", poEvent) End Sub ' SFDialogs.SF_Dialoglistener._SFKEY_keyReleased REM ----------------------------------------------------------------------------- Public Sub _SFKEY_disposing() End Sub REM ----------------------------------------------------------------------------- Public Sub _SFMOUSE_mouseEntered(Optional ByRef poEvent As Object) ''' Triggered by the OnMouseEntered event in a dialog or dialog control ''' The event is triggered thru a com.sun.star.awt.XMouseListener ''' The argument is passed to a user routine stored in the SF_Dialog or SF_DialogControl instance ''' as a scripting framework URI _TriggerEvent("mouseEntered", poEvent) End Sub ' SFDialogs.SF_Dialoglistener._SFMOUSE_mouseEntered REM ----------------------------------------------------------------------------- Public Sub _SFMOUSE_mouseExited(Optional ByRef poEvent As Object) ''' Triggered by the OnMouseExited event in a dialog or dialog control ''' The event is triggered thru a com.sun.star.awt.XMouseListener ''' The argument is passed to a user routine stored in the SF_Dialog or SF_DialogControl instance ''' as a scripting framework URI _TriggerEvent("mouseExited", poEvent) End Sub ' SFDialogs.SF_Dialoglistener._SFMOUSE_mouseExited REM ----------------------------------------------------------------------------- Public Sub _SFMOUSE_mousePressed(Optional ByRef poEvent As Object) ''' Triggered by the OnMousePressed event in a dialog or dialog control ''' The event is triggered thru a com.sun.star.awt.XMouseListener ''' The argument is passed to a user routine stored in the SF_Dialog or SF_DialogControl instance ''' as a scripting framework URI _TriggerEvent("mousePressed", poEvent) End Sub ' SFDialogs.SF_Dialoglistener._SFMOUSE_mousePressed REM ----------------------------------------------------------------------------- Public Sub _SFMOUSE_mouseReleased(Optional ByRef poEvent As Object) ''' Triggered by the OnMouseReleased event in a dialog or dialog control ''' The event is triggered thru a com.sun.star.awt.XMouseListener ''' The argument is passed to a user routine stored in the SF_Dialog or SF_DialogControl instance ''' as a scripting framework URI _TriggerEvent("mouseReleased", poEvent) End Sub ' SFDialogs.SF_Dialoglistener._SFMOUSE_mouseReleased REM ----------------------------------------------------------------------------- Public Sub _SFMOUSE_disposing() End Sub REM ----------------------------------------------------------------------------- Public Sub _SFMOVE_mouseDragged(Optional ByRef poEvent As Object) ''' Triggered by the OnMouseDragged event in a dialog or dialog control ''' The event is triggered thru a com.sun.star.awt.XMouseMotionListener ''' The argument is passed to a user routine stored in the SF_Dialog or SF_DialogControl instance ''' as a scripting framework URI _TriggerEvent("mouseDragged", poEvent) End Sub ' SFDialogs.SF_Dialoglistener._SFMOUSE_mouseDragged REM ----------------------------------------------------------------------------- Public Sub _SFMOVE_mouseMoved(Optional ByRef poEvent As Object) ''' Triggered by the OnMouseMoved event in a dialog or dialog control ''' The event is triggered thru a com.sun.star.awt.XMouseMotionListener ''' The argument is passed to a user routine stored in the SF_Dialog or SF_DialogControl instance ''' as a scripting framework URI _TriggerEvent("mouseMoved", poEvent) End Sub ' SFDialogs.SF_Dialoglistener._SFMOUSE_mouseMoved REM ----------------------------------------------------------------------------- Public Sub _SFMOVE_disposing() End Sub REM ----------------------------------------------------------------------------- Public Sub _SFTEXT_textChanged(Optional ByRef poEvent As Object) ''' Triggered by the OnTextChanged event in a dialog control ''' The event is triggered thru a com.sun.star.awt.XTextListener ''' The argument is passed to a user routine stored in the SF_DialogControl instance ''' as a scripting framework URI _TriggerEvent("textChanged", poEvent) End Sub ' SFDialogs.SF_Dialoglistener. _SFTEXT_textChanged REM ----------------------------------------------------------------------------- Public Sub _SFTEXT_disposing() End Sub REM ============================================================= PRIVATE METHODS REM ----------------------------------------------------------------------------- Public Function _SetOnProperty(ByRef poInstance As Object _ , ByVal psProperty As String _ , ByVal psScript As String _ ) As Boolean ''' Set one of the On properties related to either a SF_Dialog or SF_DialogControl instance ''' Such a property is typically set by next pseudo-code: ''' poInstance.psProperty = psScript ''' It requires a strictly identical nomenclature of internal variables in both classes. ''' Args: ''' poInstance: a SF_Dialog or a SF_DialogControl instance ''' psProperty: one of the applicable On properties ("OnFocusGained", "OnMouseMoved", ...) ''' psScript: the script to run when the event is triggered ''' When the zero-length string, the trigger is deactivated Dim bSet As Boolean ' Return value Dim oModel As Object ' com.sun.star.awt.XControlModel Dim oView As Object ' com.sun.star.awt.XControl Dim oDialogEvents As Object ' com.sun.star.container.XNameContainer Dim sListener As String ' Applicable listener, depending on property, f.i. "XMouseListener" Dim sEventName As String ' Internal event name Dim iCounterIncrement As Integer ' Increment to be applied on listener counter Dim sPrevious As String ' Actual value of script before the change Const cstPrefix = "com.sun.star.awt." bSet = True Check: If IsNull(poInstance) Or Len(psProperty) = 0 Then GoTo Catch With poInstance ' Initialize local variables depending on instance type If .ObjectType = "DIALOG" Then Set oModel = ._DialogModel Set oView = ._DialogControl Else ' DIALOGCONTROL Set oModel = ._ControlModel Set oView = ._ControlView End If If IsNull(oModel) Or IsNull(oView) Then GoTo Catch ' Ignore request if an event has been statically preset (in the Basic IDE) with the same name Set oDialogEvents = oModel.getEvents() sListener = ._GetListener(psProperty) sEventName = cstPrefix & sListener & "::" & ._GetEventName(psProperty) If oDialogEvents.hasByName(sEventName) Then GoTo Catch Try: ' Note the target scripts. Compare previous and new values. Fix the increment to be applied on counter Select Case UCase(psProperty) Case UCase("OnActionPerformed") sPrevious = ._OnActionPerformed ._OnActionPerformed = psScript Case UCase("OnAdjustmentValueChanged") sPrevious = ._OnAdjustmentValueChanged ._OnAdjustmentValueChanged = psScript Case UCase("OnFocusGained") sPrevious = ._OnfocusGained ._OnFocusGained = psScript Case UCase("OnFocusLost") sPrevious = ._OnFocusLost ._OnFocusLost = psScript Case UCase("OnItemStateChanged") sPrevious = ._OnItemStateChanged ._OnItemStateChanged = psScript Case UCase("OnKeyPressed") sPrevious = ._OnKeyPressed ._OnKeyPressed = psScript Case UCase("OnKeyReleased") sPrevious = ._OnKeyReleased ._OnKeyReleased = psScript Case UCase("OnMouseDragged") sPrevious = ._OnMouseDragged ._OnMouseDragged = psScript Case UCase("OnMouseEntered") sPrevious = ._OnMouseEntered ._OnMouseEntered = psScript Case UCase("OnMouseExited") sPrevious = ._OnMouseExited ._OnMouseExited = psScript Case UCase("OnMouseMoved") sPrevious = ._OnMouseMoved ._OnMouseMoved = psScript Case UCase("OnMousePressed") sPrevious = ._OnMousePressed ._OnMousePressed = psScript Case UCase("OnMouseReleased") sPrevious = ._OnMouseReleased ._OnMouseReleased = psScript Case UCase("OnTextChanged") sPrevious = ._OnTextChanged ._OnTextChanged = psScript End Select ' Compare previous and new event to know what to do next with the listener If sPrevious = psScript Then GoTo Finally ' No change If Len(sPrevious) = 0 Then ' New event iCounterIncrement = +1 ElseIf Len(psScript) = 0 Then ' Cancel event iCounterIncrement = -1 Else ' Event replacement iCounterIncrement = 0 End If ' Setup a new fresh listener, only once by listener during dialog or control life time, ' (re)add it to the instance view or remove the existing one if not needed anymore Select Case sListener Case "XActionListener" ._ActionCounter = ._ActionCounter + iCounterIncrement If ._ActionCounter = 1 Then If IsNull(._ActionListener) Then Set ._ActionListener = CreateUnoListener("_SFACTION_", cstPrefix & sListener) If iCounterIncrement = 1 Then oView.addActionListener(._ActionListener) ElseIf ._ActionCounter <= 0 Then If Not IsNull(._ActionListener) Then oView.removeActionListener(._ActionListener) ._ActionCounter = 0 ' Prevent negative values End If Case "XAdjustmentListener" ._AdjustmentCounter = ._AdjustmentCounter + iCounterIncrement If ._AdjustmentCounter = 1 Then If IsNull(._AdjustmentListener) Then Set ._AdjustmentListener = CreateUnoListener("_SFADJUST_", cstPrefix & sListener) If iCounterIncrement = 1 Then oView.addAdjustmentListener(._AdjustmentListener) ElseIf ._AdjustmentCounter <= 0 Then If Not IsNull(._AdjustmentListener) Then oView.removeAdjustmentListener(._AdjustmentListener) ._AdjustmentCounter = 0 ' Prevent negative values End If Case "XFocusListener" ._FocusCounter = ._FocusCounter + iCounterIncrement If ._FocusCounter = 1 Then If IsNull(._FocusListener) Then Set ._FocusListener = CreateUnoListener("_SFFOCUS_", cstPrefix & sListener) If iCounterIncrement = 1 Then oView.addFocusListener(._FocusListener) ElseIf ._FocusCounter <= 0 Then If Not IsNull(._FocusListener) Then oView.removeFocusListener(._FocusListener) ._FocusCounter = 0 ' Prevent negative values End If Case "XItemListener" ._ItemCounter = ._ItemCounter + iCounterIncrement If ._ItemCounter = 1 Then If IsNull(._ItemListener) Then Set ._ItemListener = CreateUnoListener("_SFITEM_", cstPrefix & sListener) If iCounterIncrement = 1 Then oView.addItemListener(._ItemListener) ElseIf ._ItemCounter <= 0 Then If Not IsNull(._ItemListener) Then oView.removeItemListener(._ItemListener) ._ItemCounter = 0 ' Prevent negative values End If Case "XKeyListener" ._KeyCounter = ._KeyCounter + iCounterIncrement If ._KeyCounter= 1 Then If IsNull(._KeyListener) Then Set ._KeyListener = CreateUnoListener("_SFKEY_", cstPrefix & sListener) If iCounterIncrement = 1 Then oView.addKeyListener(._KeyListener) ElseIf ._KeyCounter <= 0 Then If Not IsNull(._KeyListener) Then oView.removeKeyListener(._KeyListener) ._KeyCounter = 0 ' Prevent negative values End If Case "XMouseListener" ._MouseCounter = ._MouseCounter + iCounterIncrement If ._MouseCounter= 1 Then If IsNull(._MouseListener) Then Set ._MouseListener = CreateUnoListener("_SFMOUSE_", cstPrefix & sListener) If iCounterIncrement = 1 Then oView.addMouseListener(._MouseListener) ElseIf ._MouseCounter <= 0 Then If Not IsNull(._MouseListener) Then oView.removeMouseListener(._MouseListener) ._MouseCounter = 0 ' Prevent negative values End If Case "XMouseMotionListener" ._MouseMotionCounter = ._MouseMotionCounter + iCounterIncrement If ._MouseMotionCounter = 1 Then If IsNull(._MouseMotionListener) Then Set ._MouseMotionListener = CreateUnoListener("_SFMOVE_", cstPrefix & sListener) If iCounterIncrement = 1 Then oView.addMouseMotionListener(._MouseMotionListener) ElseIf ._MouseMotionCounter <= 0 Then If Not IsNull(._MouseMotionListener) Then oView.removeMouseMotionListener(._MouseMotionListener) ._MouseMotionCounter = 0 ' Prevent negative values End If Case "XTextListener" ._TextCounter = ._TextCounter + iCounterIncrement If ._TextCounter = 1 Then If IsNull(._TextListener) Then Set ._TextListener = CreateUnoListener("_SFTEXT_", cstPrefix & sListener) If iCounterIncrement = 1 Then oView.addTextListener(._TextListener) ElseIf ._TextCounter <= 0 Then If Not IsNull(._TextListener) Then oView.removeTextListener(._TextListener) ._TextCounter = 0 ' Prevent negative values End If End Select End With Finally: _SetOnProperty = bSet Exit Function Catch: bSet = False GoTo Finally End Function ' SFDialogs.SF_Dialoglistener._SetOnProperty REM ----------------------------------------------------------------------------- Public Sub _TriggerEvent(ByVal EventType, Optional ByRef poEvent As Object) ''' Triggered by the EventType event in a dialog or dialog control ''' The argument is passed to a user routine stored in the SF_Dialog or SF_DialogControl instance ''' as a scripting framework URI Dim oDialog As Object ' The SF_Dialog or SF_DialogControl object having triggered the event Dim sScript As String ' Script to be invoked On Local Error GoTo Catch ' Avoid stopping event scripts Check: If IsNull(poEvent) Or IsMissing(poEvent) Then Exit Sub Try: Set oDialog = ScriptForge.SF_Services.CreateScriptService("SFDialogs.DialogEvent", poEvent) If IsNull(oDialog) Then Exit Sub With oDialog Select Case EventType Case "actionPerformed" : sScript = .OnActionPerformed Case "adjustmentValueChanged" : sScript = .OnAdjustmentValueChanged Case "focusGained" : sScript = .OnFocusGained Case "focusLost" : sScript = .OnFocusLost Case "itemStateChanged" : sScript = .OnItemStateChanged Case "mouseDragged" : sScript = .OnMouseDragged Case "mouseEntered" : sScript = .OnMouseEntered Case "mouseExited" : sScript = .OnMouseExited Case "mouseMoved" : sScript = .OnMouseMoved Case "mousePressed" : sScript = .OnMousePressed Case "mouseReleased" : sScript = .OnMouseReleased Case "textChanged" : sScript = .OnTextChanged Case Else : sScript = "" ' Should not happen End Select If Len(sScript) = 0 Then Exit Sub ScriptForge.SF_Session._ExecuteScript(sScript, poEvent) End With Finally: Exit Sub Catch: GoTo Finally End Sub ' SFDialogs.SF_Dialoglistener._TriggerEvent REM ============================================ END OF SFDIALOGS.SF_DIALOGLISTENER </script:module>