Left Mouse Button not being Detected

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
wlaughto
Posts: 30
Joined: Fri Apr 07, 2017 5:06 am

Left Mouse Button not being Detected

Post by wlaughto » Wed Jun 17, 2020 4:33 am

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?

wlaughto
Posts: 30
Joined: Fri Apr 07, 2017 5:06 am

Re: Left Mouse Button not being Detected

Post by wlaughto » Wed Jun 17, 2020 6:57 am

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?

SparkOut
Posts: 2852
Joined: Sun Sep 23, 2007 4:58 pm

Re: Left Mouse Button not being Detected

Post by SparkOut » Wed Jun 17, 2020 7:43 am

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.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9388
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Left Mouse Button not being Detected

Post by richmond62 » Wed Jun 17, 2020 8:08 am

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
Attachments
Which Button.livecode.zip
Here's the stack.
(31.05 KiB) Downloaded 167 times

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9388
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Left Mouse Button not being Detected

Post by richmond62 » Wed Jun 17, 2020 9:40 am

racial.png
-
It is very, very important not to discriminate against certain mice.

RossG
Posts: 247
Joined: Thu Jan 08, 2015 7:38 am

Re: Left Mouse Button not being Detected

Post by RossG » Fri Jun 19, 2020 3:58 am

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.
Is age an excuse? Eighty-four and counting.
Programming powered by coffee.

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”