Vexing inconsistent problem with click location. Crazy!!

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

EdocEvil
Posts: 14
Joined: Thu Nov 19, 2020 5:46 am

Vexing inconsistent problem with click location. Crazy!!

Post by EdocEvil » Thu Nov 19, 2020 9:48 am

This might be a well-known LC bug. If so, sorry for the inconvenience. I don't remember how to search for known LC bugs.

I'm starting to suspect my copy of LC is corrupted, though it seems strange that both Indy and Community would get corrupted at the same time (see below).

Over the years, I've noticed on rare occasions that the cursor location of mouse clicks don't correspond to where LC senses the click. I'm pretty sure this happens on various stacks, though at the moment, I'm looking at my Rolodex stack, a simple stack, based on the original hyperCard index card analogy.

If I click on a line in the clickable index, it will react as if I clicked on a line a certain number of pixels below where I actually clicked. Typically, about four lines lower, so I end up clicking on the wrong line. Once the issue starts happening, it happens in both locked and unlocked fields, and also affects buttons. If the line (or button, or field) I want to click is near the bottom of the card or LC window, I can't click it at all. Once this starts happening, it seems to affect all fields, buttons, and scroll bars, in any card in the stack, and possibly other stacks. The mis-registration is always vertical, never horizontal, but the amount of vertical click offset seems somewhat inconsistent.

I've never been able to figure out why this happens, or how to fix it, except by re-starting LiveCode. When I do that, everything has worked normally again, and sometimes weeks or months go by, before it happens again. Let me emphasize this happens when I haven't touched any script, button, or field, prior to the onset of the issue.

This has happened occasionally through several Mac OS machines, many iterations of Mac OS and many iterations of LiveCode. It goes back at least five years, and maybe ten. However, I understand the resemblance to the current issue may be coincidental.

I recently let my Indy license expire and switched back to Community. I'm not authoring stacks like I used to. (Is it still called authoring?) I noticed the problem again today, when using Community. I have a few days left on my Indy license, so I opened the same stack with Indy, had the same problem. I realize the change in LC versions is probably a coincidence.

Now, starting a few hours ago, it is happening all the time, and the stack in question is nearly un-useable, and it's getting worse! This time, quitting and re-starting the stack, or LiveCode, is not solving the problem. Restarting my machine didn't help, either. Edit: As far as I can tell, all my liveCode stacks are affected, and they are all becoming un-usable.

The issue doesn't affect the little yellow and red dots at the upper left corner of the stack windows, the close and minimize buttons. It doesn't affect the title bar. It doesn't affect the dropdown menus for the LC application. It does affect the Tools palette.

I have done all the obvious LC troubleshooting things. Looking for rogue globals, watching the message watcher, etc. Nothing. My machine is otherwise working normally.

Please advise.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9580
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Vexing inconsistent problem with click location. Crazy!!

Post by dunbarx » Thu Nov 19, 2020 2:17 pm

Hi.

When I first started reading your post I thought I had the answer, provided you were using another monitor for certain tasks. I spent a lot of time synchronizing the locs of things between two adjacent screens.

But it sounds like this is on a single monitor. If you put this in the card script:

Code: Select all

on mouseMove x,y
   put x && y
end mouseMove
However you size or place the card window, do the numbers seem to make sense?

I cannot imagine that LC particularly has lost track of it place in the world.

Craig

EdocEvil
Posts: 14
Joined: Thu Nov 19, 2020 5:46 am

Re: Vexing inconsistent problem with click location. Crazy!!

Post by EdocEvil » Thu Nov 19, 2020 6:59 pm

Hi Craig,

I did the test you suggested with a bare stack, just one button. The loc of the button is 199,20. When the cursor hovers over the button, the location of the cursor is 190,-77, give or take. (This is with the external monitor un-plugged, see below.)

Good thought about the other monitor. I have another monitor, but it is normally disconnected, and it was disconnected throughout this whole episode.

Nevertheless, I plugged in the other monitor, dragged the test stack to the other monitor. The stack started working normally. I dragged the same stack back to the screen on my machine and it continued to work. I then unplugged the monitor, and the weird condition returned.

Further experimentation suggests inconsistent results relative to which screen displays the stacks, and whether the monitor is connected.

We're part way to a solution. The remaining puzzle is why this condition affects only LiveCode, and not other applications.

I'm not accustomed to a second monitor. Is an extra script necessary when displaying a LC stack on a second monitor? Is it okay to simply un-plug the monitor's data cable? Must I somehow un-mount the monitor?

EE

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Vexing inconsistent problem with click location. Crazy!!

Post by jacque » Fri Nov 20, 2020 8:22 pm

It sounds like LC only determines monitor setup on launch. Did you restart LC after changing the external monitor?

Edit: I see from your first post that you did. Did you also check the Monitors control panel to see how many monitors it shows? If LC is querying the system configuration it may be returning incorrect data.

I don't have an external monitor so this is all guesswork.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9580
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Vexing inconsistent problem with click location. Crazy!!

Post by dunbarx » Fri Nov 20, 2020 10:28 pm

And make sure the monitors control panel has your "main" screen as, er, the main screen.

If you get these crazy numbers, are they at least consistent? If so, and I suspect as much, then I am with Jacque. It is your setup and OS that needs attention. not LC.

Craig

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9580
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Vexing inconsistent problem with click location. Crazy!!

Post by dunbarx » Fri Nov 20, 2020 10:31 pm

Just reread your last post.

Are you saying that the loc of the button is different than the mouseLoc? I can understand that these two objects might seem woefully out of place in terms of what sort of values we visually expect from their locations, but not that they return different values between themselves.

Craig

EdocEvil
Posts: 14
Joined: Thu Nov 19, 2020 5:46 am

Re: Vexing inconsistent problem with click location. Crazy!!

Post by EdocEvil » Sat Nov 21, 2020 7:12 am

Many thanks to Craig and Jacque.

Jacque wrote:
Did you also check the Monitors control panel to see how many monitors it shows? If LC is querying the system configuration it may be returning incorrect data.
Yes, I have checked that. The Display control panel seems to be working normally. If the external monitor is not plugged in, the title is "built-in display." Resolution is "Default for Display."

If I plug in the external monitor, the display control panel updates to reflect that I have connected another display. If i unplug the monitor, it updates again, to indicate only the built-in display is connected. Restarting the machine has not been productive.

Craig wrote:
If you get these crazy numbers, are they at least consistent?
Craig previously suggested I make a new stack, with just one card and one button, and put this in the card script:

Code: Select all

on mousemove x,y
   put x && y
end mousemove
I did that. The loc of the button is 199,20. When I hover the cursor over the button, the script give me inconsistent results for the Y axis of the mouse. The X axis is always correct. In other words, the visual location of the cursor on the screen does not consistently correspond to the LC's understanding of the mouse location. This applies to the Y axis only.

If I watch the loc of the mouse in the message window, I can maneuver the cursor so it is the same as the loc of the button. If I click there, the button hilites, indicating the click is detected at the location where LC thinks the mouse is. However, on my screen, the visual location of the cursor is many pixels below the button.

Yikes! I just found something weird and significant. I changed Craig's card script to:

Code: Select all

on mousemove x,y
     put x && y && the top of this stack
end mousemove
I now see that LC reports an incorrect value of "the top of this stack" when I drag the stack closer to the top of my screen. LC thinks "the top of this stack" is 224 when it should be less than 224. Even if I drag the LC stack title bar all the way to the top of my display screen, LC continues to report the value of 224, when it should be zero, or a small number. When I drag the title bar below the top third of my screen, the "top" value reported by LC appears normal, and the mouse/cursor discrepancy goes away. Weird! It also looks like the mouseMove message is not getting sent reliably when the top of the stack ought to be < 224.

Meanwhile, the appearance of my screen is normal, and other applications are working normally. I'm typing this message in the LiveCode forum using my Chrome web browser, for instance. It works perfectly.

The external monitor is unplugged and my machine has been restarted.

Craig wrote:
I am with Jacque. It is your setup and OS that needs attention. not LC.
I get your logic.

Still, it's odd that LC is the only application affected. It's also odd that only the Y axis of the cursor is affected. I don't think my copy of LC Community is corrupted, because I have seen the same problem with LC Indy. I have both installed on my machine.

II hope there is some way to make LC work again on my machine. I guess I could buy a new machine... I'll do that, if necessary, but it seems extreme!

It might be a driver issue. I don't know how to remove and reinstall the display drivers. Or maybe there's a way to make the display drivers reset to their default values. Anybody know? (That sounds like a risky thing to do on my only machine.)

Do you think it would help to reinstall the OS?

Aside from buying a new machine, any other suggestions?

Thanks again,

EE

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Vexing inconsistent problem with click location. Crazy!!

Post by jacque » Sat Nov 21, 2020 6:11 pm

I don't think it's your Mac or the OS, you'd see problems in other apps if it were. It's starting to sound more like stack corruption except for the fact that you created a new blank one for a test (I assume you did that from the File menu, not by cloning an existing stack.)

You said all your stacks were acting the same. Are they all clones of each other? What happens if you download someone else's stack from the Sample Stacks in the top toolbar? Does that act normally?

Do your own stacks have menus? The way LC treats system menus on a Mac affects the reported positions of things. If there's corruption it might be that the menu group is incorrectly sized.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Vexing inconsistent problem with click location. Crazy!!

Post by FourthWorld » Sat Nov 21, 2020 7:53 pm

If the LiveCode engine is corrupted, it probably won't run. If it runs we can usually rule that out.

If a stack is corrupted, it probably won't open. If it opens at can usually rule that out.

If everything works splendidly but one very specific thing, that's probably a bug.

And if that bug is not evident in any other software, it probably lives in the software exhibiting the bug.

In short, EE, deduction suggests your instincts are correct, that you've found a bug in the LiveCode engine. We don't know enough yet to say with absolute certainty, but all signs so far reinforce your hunch.

Now we have the tough job of seeing if we can find a recipe for reliably reproducing the bug at will on other systems. Once we can do that, most bugs are relatively easy to fix.

This one may be difficult to pin down.

Don't know yet for sure if this is related, but on Linux LC sometimes displays popup menus much further to the right and slightly down from where I'm clicking.

Also maybe related (or not), the mouseColor sometimes returns unpredictable values, quite different from what the mouse is over.

In both cases I have a second monitor. I do not see these issues on my single-monitor laptop. And I so frequently rely on my second monitor that I've not yet tested to see what happens if I disconnect the second monitor.

If I find a recipe for either I'll post it here with a sample stack so others can confirm. Please do the same, and with any luck we'll knock these out together.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

EdocEvil
Posts: 14
Joined: Thu Nov 19, 2020 5:46 am

Re: Vexing inconsistent problem with click location. Crazy!!

Post by EdocEvil » Sat Nov 21, 2020 8:23 pm

Thanks very much, Richard and Jacque,

Jacque wrote:
Are they all clones of each other?
No, the current test stack is a brand new stack, made from scratch. No other stacks in use.
What happens if you download someone else's stack from the Sample Stacks in the top toolbar?
That is an excellent question. I will investigate and report back.

Richard wrote:
If I find a recipe for either I'll post it here with a sample stack so others can confirm. Please do the same, and with any luck we'll knock these out together.
I'm relieved to learn I'm not doing something dumb, or losing my mind. After a period of intense frustration, I'm calming down and becoming philosophical.

I'm happy to do my part. I will attempt the few simple troubleshooting and isolating stratagems that come to mind. I'm not very good at this, but not completely helpless. I will report back on this thread.

Suggestions for investigating this issue further would be very welcome. Certain scripts might tell us a lot.

I'll install Community on my wife's MacBook Air, and try my test stack on her machine. I will also download a fresh copy of Community on my machine, see what happens.

EE

(I used to be Tim, or Timothy Miller, or Doctor Timothy Miller, or possibly Timborino. I couldn't log in to my old forum account, so I made a new one.)

EdocEvil
Posts: 14
Joined: Thu Nov 19, 2020 5:46 am

Re: Vexing inconsistent problem with click location. Crazy!!

Post by EdocEvil » Sat Nov 21, 2020 11:37 pm

My investigations so far:

-- Confirmed the same issue occurs whether I make a brand new test stack with Indy or Community
-- Deleted LC Community, along with its preferences, downloaded and installed a fresh copy made a brand new test stack. Same issue
-- Downloaded the Hangman stack from the sample stacks on the LC site. It works normally -- almost -- see next item
-- When trying to quit the sample Hangman stack, the "Save changes" dialog box doesn't work. The "save" "cancel" and "Don't save" buttons are unresponsive. Oops! If I drag the "Save changes" window to the lower part of my screen, it works normally.
-- Tried my test stack again. If it is positioned near the top of my screen and I quit LC, the "save changes" dialog box doesn't work, because the buttons are unresponsive. If I position the same stack near the lower part of my screen, the "save changes" button works normally.

Tried a new test script in the card script:

Code: Select all

on moveStack
   put the rect of this stack
   pass moveStack
end moveStack
-- The script reports normal values except the second item, which I believe represents the "top," is abnormal. As I slowly drag the stack upward, from the lower part of my screen, item 2 increments down, as it should, until it gets to 204. If I drag the stack up one more pixel, item 2 is reported as 224 and continues to report this value as I drag the stack all the way to the top of my screen. If I drag the top of the stack back down to 204 or below, the top value is again reported normally.

-- If I change that script to report the height of the stack, the correct value is reported as I drag the stack around. If I make the stack resizable, resize it and drag it around, the correct height is reported.

-- I downloaded a trial version of Indy to my wife's MacBook Air. Hers is a later model, though her OS is still Catalina. I made a similar test stack. It worked normally. I copied my test stack from my machine to hers. It worked normally on her machine.

Using other applications, I notice my cursor is kinda glitchy when I move it around. Sometimes it moves a little jerkily, and sometimes the little black cursor arrow gets much bigger for a second or two. I don't know if this is common. I wonder if there is some subtle hardware problem on my machine.

Next step: Reinstall the operating system

EE, aka Tim
Last edited by EdocEvil on Sun Nov 22, 2020 1:05 am, edited 3 times in total.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Vexing inconsistent problem with click location. Crazy!!

Post by FourthWorld » Sat Nov 21, 2020 11:38 pm

EdocEvil wrote:
Sat Nov 21, 2020 8:23 pm
I'll install Community on my wife's MacBook Air, and try my test stack on her machine. I will also download a fresh copy of Community on my machine, see what happens.
That seems a good step.
(I used to be Tim, or Timothy Miller, or Doctor Timothy Miller, or possibly Timborino. I couldn't log in to my old forum account, so I made a new one.)
Doctor Timothy Miller! Yes, I remember you well. Welcome back.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

PBH
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 129
Joined: Sun Feb 20, 2011 4:26 pm
Location: Vancouver Island, BC, Canada. ex.UK
Contact:

Re: Vexing inconsistent problem with click location. Crazy!!

Post by PBH » Sun Nov 22, 2020 2:09 am

LiveCode does have a known problem like you describe when two or more monitors are used on a Mac and the tops of the screens are not aligned in the Arrangement tab of the Displays panel in the System Preferences.

I have experienced this problem in the past, but since keeping my monitors aligned at the top I have't had any further issue.

I would suggest, close LC, connect your external monitor, open System Preferences > Displays and choose the Arrangement tab, now align the tops of both screens and close the prefs., launch LC then try again, both with and without your external monitor connected. I hope this helps.
and sometimes the little black cursor arrow gets much bigger for a second or two. I don't know if this is common. I wonder if there is some subtle hardware problem on my machine.
There is a setting in System Preferences > Accessibility under the "Cursor" tab that allows you to "Shake mouse pointer to locate", it does what you describe here, is that turned on?

Paul

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9580
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Vexing inconsistent problem with click location. Crazy!!

Post by dunbarx » Sun Nov 22, 2020 5:36 am

"Shake mouse pointer to locate",
So THAT is what is happening. I thought it was just something silly in the OS, not a way to find the cursor when inebriated.

Craig

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9580
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Vexing inconsistent problem with click location. Crazy!!

Post by dunbarx » Sun Nov 22, 2020 5:42 am

Just to be clear, and that is something I rarely am, does this issue occur when only ONE monitor is running? If no, then I cannot think it is a LC issue per se, but rather environmental.

Craig

Post Reply

Return to “Talking LiveCode”