View Full Version : Handling mouse movements in ASP.Net web service
dlmann1217
09-18-2002, 08:41 PM
I am writing a web service that needs to get the characteristics of the mouse cursor. I am currently able to acquire the (x,y) of its click point, but I would also like to be able to trace its coordinates as it moves and determine which button has been pressed. I can't seem to find any good resources that address this subject for ASP.Net. Any help would be appreciated. TIA
David
whammy
09-18-2002, 11:00 PM
This should be in the javascript forum. Unless you have some other questions that pertain specifically to ASP, I'm going to move you there so you can get more help. :)
dlmann1217
09-18-2002, 11:08 PM
Well, since I'm not actually using javascript, but rather ASP and VB.net I figured this was the best place for this question. However, I'm looking to be whereever I can get the most help, so I'll leave that to your discretion. :thumbsup:
whammy
09-19-2002, 02:00 AM
Well this really is a javascript question (I think - how are you getting the coordinates right now?), since ASP.Net like any other server-side scripting language (as far as I know since I haven't had time to delve into it much) cannot interact directly with the client's browser.
If I'm wrong, please say so here, and I'm sure someone will kindly move the thread back! I haven't had time to learn too much ASP.Net to this point. :)
I'm going to go ahead and move this thread since I think that's your best bet.
:)
glenngv
09-19-2002, 02:31 AM
<body onmousemove="window.status=event.clientX+' X '+event.clientY">
look at the status bar as you move the mouse
dlmann1217
09-19-2002, 04:46 PM
Here is the code I am currently using to capture the mouse click coordinates on an image:
<SCRIPT runat="server">
dim height, base, hypotenuse, scale
public Sub GetCoordinates (Source As Object, Coords As ImageClickEventArgs)
height = abs(Coords.Y - session("Ycoord"))
base = abs(Coords.X - session("Xcoord"))
hypotenuse = Round(sqrt((height * height) + (base * base)))
Distance.Text = "Based on a scale where 1 pixels = 2.5 miles, the distance would be " & (hypotenuse * 2.5)
session("Xcoord") = Coords.X
session("Ycoord") = Coords.Y
End Sub
</SCRIPT>
<form runat="server" ID="myForm" name="myForm">
<asp:ImageButton id="MyImage" ImageURL="texas.jpg" AlternateText="Texas" ImageAlign="Middle" onClick="GetCoordinates" runat="server" />
<br>
<asp:Label id="Distance" runat="server" />
</form>
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.