I would like my GestureDetection WebSDK control to also detect scroll events in a target WebControl.
Scroll wheel action may not always be for scrolling, and therefore scroll details should be passed to an event handler when scrolling is disabled.
I have successfully added a mouse wheel event listener, but the challenge starts when I want to pass the data back to the ExecuteEvent. see my attempt bellow.
strGestures.Append(" // cross-browser wheel delta")
strGestures.Append(" var e = window.event || e; // old IE support")
strGestures.Append(" var delta = Math.max(-1, Math.min(1, (e.wheelDelta || -e.detail)));")
strGestures.Append("Xojo.triggerServerEvent('" + me.ControlID + "', 'mouseWheel', [e])")
strGestures.Append(" return false;")
[code] Select Case name…
...Case "mouseWheel" Dim Details as REALBasic.MouseEvent = Parameters(0) End Select[/code]
The code above failed with an illegal cast exception. “_VarientString cannot be cast to REALBasic.MouseEvent”
I could pass each detail back in a JS array but that’s not a very elegant solution. Other Xojo mouse events make use of the REALBasic.MouseEvent quite well. Is there anyway I can do the same?
I also noticed the Framework.js uses mouse wheel event listeners. Am I likely to break the framework if I add addition listeners to WebControls?
Any help would be much appreciated!