OnMouseEvent
Event: OnMouseEvent (nXPos as Long, nYPos as Long, eMouseEvent as SPYMouseEvent, objRange as AuthenticRange) as Boolean
XMLSpy scripting environment - VBScript:
Function On_AuthenticMouseEvent(nXPos, nYPos, eMouseEvent, objRange)
' On_AuthenticMouseEvent = True ' to cancel bubbling of event
End Function
XMLSpy scripting environment - JScript:
function On_AuthenticMouseEvent(nXPos, nYPos, eMouseEvent, objRange)
{
// return false; /* to cancel bubbling of event */
}
XMLSpy IDE Plugin:
IXMLSpyPlugIn.OnEvent (31, ...) // nEventId = 31
Description
This event gets triggered for every mouse movement and mouse button Windows message.
The actual message type and the mouse buttons status, is available in the eMouseEvent parameter. Use the bit-masks defined in the enumeration datatype SPYMouseEvent to test for the different messages, button status, and their combinations.
The parameter objRange identifies the part of the document found at the current mouse cursor position. The range objects always selects a complete tag of the document. (This might change in future versions, when a more precise positioning mechanism becomes available). If no selectable part of the document is found at the current position, the range object is null.
REMARK: The following events from the scripting environment and IDE Plugin of XMLSpy are still supported but become obsolete with this event:
On_AuthenticMouseMove() IXMLSpyPlugIn.OnEvent (15, ...) // nEventId = 15
On_AuthenticButtonUp() IXMLSpyPlugIn.OnEvent (16, ...) // nEventId = 16
On_AuthenticButtonDown() IXMLSpyPlugIn.OnEvent (17, ...) // nEventId = 17
On_AuthenticButtonDoubleClick() IXMLSpyPlugIn.OnEvent (24, ...) // nEventId = 24
Examples
' ----------------------------------------------------------------------------
' VB code snippet - connecting to object level events
' ----------------------------------------------------------------------------
' access XMLSpy (without checking for any errors)
Dim objSpy As XMLSpyLib.Application
Set objSpy = GetObject("", "XMLSpy.Application")
' this is the event callback routine connected to the OnMouseEvent
' event of object objView. If you click with the left mouse button
' while pressing a control key, the current selection will be set
' to the tag below the current mouse cursor position
Private Function objView_OnMouseEvent(ByVal i_nXPos As Long, ByVal i_nYPos As Long, ByVal i_eMouseEvent As XMLSpyLib.SPYMouseEvent, ByVal i_pRange As XMLSpyLib.IAuthenticRange) As Boolean
If (i_eMouseEvent = (XMLSpyLib.spyLeftButtonDownMask Or XMLSpyLib.spyCtrlKeyDownMask)) Then
On Error Resume Next
i_pRange.Select
objView_OnMouseEvent = True
Else
objView_OnMouseEvent = False
End If
End Function
' use VBA keyword WithEvents to connect to object-level event
Dim WithEvents objView As XMLSpyLib.AuthenticView
Set objView = objSpy.ActiveDocument.AuthenticView
' continue here with something useful ...
' and serve the windows message loop