Mouse Up event only work once until window is moved..

Hi Everyone,

I’ve done some searching and I haven’t be able to fine a solution to my problem. I’m using the following bit of code in XCode and though it works fine and places the mouse position into the text fields as it should, it only works once. Once that is until I move the window then the event will work again. It is almost as though the event is not being disposed of… Anyone have any ideas?

Regards

Chris

on mouse up theObject event theEvent
if name of theObject is “btn” then
set {MpX, MpY} to location of theEvent
set contents of text field “x” of window “main” to (MpX) as string
set contents of text field “y” of window “main” to (MpY) as string
end if
end mouse up

Hi

I’ve just had a thought that might explain this. Is the location of the event I’m recieving the position of the button and not really the mouse. If so this would explain why it works after a move. If this is the case does anyone know how I can get the screen position of the mouse.

Edit: Ok that is it. I’m recieving the button position in the event not the mouse.

Regards

Chris