Page 1 of 1

Left Mouse Button not being Detected

Posted: Wed Jun 17, 2020 4:33 am
by wlaughto
Running on Windows 10, neither the mouseUp nor mouseDown are being detected. Simple input field with the following code:-

Code: Select all

on mouseUp mousebutton
   answer "You clicked button " & mousebutton
end mouseUp
Right mouse detected and returned 3 as expected, by left click does not return anything.

Have tried different mice and 2 different Win10 PCs. Oh, yes the left button does work e.g. if i put text into the field, I can drag the mouse with left key to hilite a bunch of text.

What am I doing wrong?

Re: Left Mouse Button not being Detected

Posted: Wed Jun 17, 2020 6:57 am
by wlaughto
I maybe using the incorrect handler for what I want to do. Instead of mouseUP/Down, the OpenField does what I need for this.

However, this still does not answer the question why the mouseUP/Down does not return anything for a left click on the mouse when in a field. I appreciate probably more suited to a button, checkbox etc, but any reason it would not work in a field?

Re: Left Mouse Button not being Detected

Posted: Wed Jun 17, 2020 7:43 am
by SparkOut
This is because a field only receive "mouse*" messages if it is locked.
The reason being that for editable fields, as you have described, mouse messages are needed to behave as expected by the o/s human interface to perform selection actions, placement of cursor position etc. This could cause confusion, unwanted effects or even runway message recursion depending on how badly the code screws things up. So yes, set the locked first if you need to have mouse messages to trigger on a field.

Re: Left Mouse Button not being Detected

Posted: Wed Jun 17, 2020 8:08 am
by richmond62
Screenshot 2020-06-17 at 10.07.13.png
-
Too much time on my hands. :D

A word of warning . . .

I have 2 mice connected to my computer: one for my right-hand and one for my left-hand:
as they are oriented appropriately the left-handed mouse has its buttons the other way round. 8)

So I would be wary of using the terms "right button" and "left button"
and feel that "button 1", "button 2" and "button 3" are rather better.
-
lefty.png

Re: Left Mouse Button not being Detected

Posted: Wed Jun 17, 2020 9:40 am
by richmond62
racial.png
-
It is very, very important not to discriminate against certain mice.

Re: Left Mouse Button not being Detected

Posted: Fri Jun 19, 2020 3:58 am
by RossG
Richmond

Pleased to see that I'm not the only one who
forgot the easy way to show/hide an object
with --- "show graphic g1..." and "hide" ditto.

That aside your nice little stack answered my
next question so thanks for that.