Mouse Location Coordinates
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Mouse Location Coordinates
Is there an easy way to determine what control (ie. button) is located at a giving mouseloc coordinate?
Thanks,
Kosmo
Thanks,
Kosmo
Re: Mouse Location Coordinates
Hi Kosmo,
I believe the "mouseControl" function is what you are looking for.
Kind Regards,
Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
-
I believe the "mouseControl" function is what you are looking for.
Kind Regards,
Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
-
Re: Mouse Location Coordinates
Hi Kosmo,
and maybe check the new "ControlAtLoc" function in the dictionary.
Never used this so far
Best
Klaus
and maybe check the new "ControlAtLoc" function in the dictionary.
Never used this so far

Best
Klaus
Re: Mouse Location Coordinates
Thank you both for responding! I never heard of the ControlAtLoc...but this is exactly what I am looking for.
Appreciate your help!
Kosmo
Appreciate your help!
Kosmo
Re: Mouse Location Coordinates
Hi Kosmo,
I think "ControlAtLoc" has been added in version 6.5!
Best
Klaus
I think "ControlAtLoc" has been added in version 6.5!
Best
Klaus
Re: Mouse Location Coordinates
The ControlAtLoc is working great except when there is no control at the location. The program fails. I was hoping the program would just send back a empty value. I did find a way around this by creating a label field the size of the stack. Not sure if there is a better way to take care of this?
Thanks
Kosmo
Thanks
Kosmo
Re: Mouse Location Coordinates
Hi Kosmo,
just tested here and -> controlAtLoc(tLoc) returned EMPTY in that case?
Please post your script if possible.
Best
Klaus
just tested here and -> controlAtLoc(tLoc) returned EMPTY in that case?
Please post your script if possible.
Best
Klaus
Re: Mouse Location Coordinates
ControlAtLoc returns empty for me if there is no control at the specified loc.
Craig
Craig
Re: Mouse Location Coordinates
Craig,
I am using the following code:
if the name of (controlAtLoc(the mouseLoc)) contains "Button_" then
answer "button"
else
exit mousedown
end if
If I am on a button, I will get the "button" message. If I don't have a control at the location, I get:
card "card id 1002": execution error at line 3 (Chunk: error in object expression), char 16
I am on version 6.5.2
Thanks for any help!
Kosmo
I am using the following code:
if the name of (controlAtLoc(the mouseLoc)) contains "Button_" then
answer "button"
else
exit mousedown
end if
If I am on a button, I will get the "button" message. If I don't have a control at the location, I get:
card "card id 1002": execution error at line 3 (Chunk: error in object expression), char 16
I am on version 6.5.2
Thanks for any help!
Kosmo
Re: Mouse Location Coordinates
Hi.
You cannot exit mouseDown in a mouseUp. The controlAtLoc function returns the string "Control" and the control number. When you ask for the name of the result of that function, with no control in that loc, you are essentially asking for:
the name of empty.
LC considers this to be in the same category as bad cheese to a sensitive stomach.
But the value of this is to understand how LC evaluates the various things thrown at it. Cool, no?
Craig
You cannot exit mouseDown in a mouseUp. The controlAtLoc function returns the string "Control" and the control number. When you ask for the name of the result of that function, with no control in that loc, you are essentially asking for:
the name of empty.
LC considers this to be in the same category as bad cheese to a sensitive stomach.
But the value of this is to understand how LC evaluates the various things thrown at it. Cool, no?
Craig
Re: Mouse Location Coordinates
Craig,
Thanks for the explanation. I changed my logic a bit which now works...
on mousedown
if (controlAtLoc(the mouseLoc)) <> empty then
(do my code)
else
exit mousedown
end if
end mousedown
Appreciate all your help!
Kosmo
Thanks for the explanation. I changed my logic a bit which now works...
on mousedown
if (controlAtLoc(the mouseLoc)) <> empty then
(do my code)
else
exit mousedown
end if
end mousedown
Appreciate all your help!
Kosmo
Re: Mouse Location Coordinates
Kosmo.
Right!!! Now you are getting it.
The evaluation process within LC is one of its most powerful and endearing features. It allows, once you get used to it, terrific intuitive communication between the way humans think and the way the engine processes those thoughts. You will use this more and more, especially when you pass parameters from one handler to another.
But at the base level, like here, it must be learned by heart.
Umm. Any way you can shorten that last handler?
Craig
Right!!! Now you are getting it.
The evaluation process within LC is one of its most powerful and endearing features. It allows, once you get used to it, terrific intuitive communication between the way humans think and the way the engine processes those thoughts. You will use this more and more, especially when you pass parameters from one handler to another.
But at the base level, like here, it must be learned by heart.
Umm. Any way you can shorten that last handler?
Craig