"Click at the loc of...." thingie

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10346
Joined: Wed May 06, 2009 2:28 pm

"Click at the loc of...." thingie

Post by dunbarx » Sat Oct 19, 2019 8:15 pm

I thought this merited its own thread. This is derived from the discussion at:
viewtopic.php?f=7&t=33215
-----------
Is a feature, a bug, expected behavior or just an anomaly?

The command "click at the loc of..." does indeed click at that loc. As read, though, it seems that the cursor ought to simply stay at the loc after the click. This is not the same as moving the cursor to that loc and manually clicking. If one does that, of course, the cursor remains in that location.

Doing this under script control has to actually "move" the cursor to the prescribed loc, and not just invoke some similarly functional internal engine action. We know this because a "mouseLeave" handler in the target control will fire if asked to. But in order for that to happen, the cursor had to be actually on site, and had to actually leave that site. That is what "mouseLeave requires, and how "mouseLeave" works.

In other words, "click at the loc of..." actually physically moves the cursor wherever, clicks there, and then actually returns it to its original loc.

So, feature, bug...?

Craig

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: "Click at the loc of...." thingie

Post by bogs » Sat Oct 19, 2019 8:32 pm

I would think 'bug', but I have such a poor understanding of how the under the hood stuff works in certain cases.
Image

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10055
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: "Click at the loc of...." thingie

Post by FourthWorld » Sat Oct 19, 2019 10:30 pm

Clicking at the loc of an object triggers the object's click response, but does not affect where the user has chosen to place the cursor.

I use it most often in response to keyboard shortcuts, so that the button highlight helps cognitively reinforce the primary action the shortcut triggers.

Personally I strongly prefer to leave the user in control of things as much as possible, esp. with the cursor given its central role as an on-screen proxy for the user.

If you also need to take control of the user's cursor away from them (in certain limited cases there can be good reason to do that), that separate act can be done with separate lines of code.

In short, I'd say the HC team got this one right, and I've been very happy with the xtalks I've used who all implement "click at the loc of..." the same way HC did.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply