Hiding the cursor

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Hiding the cursor

Post by jacque » Thu Jul 11, 2024 10:14 pm

FourthWorld wrote:
Thu Jul 11, 2024 8:55 pm
The method I posted above has worked reliably for me for decades. If it's not working for you I would look elsewhere for the cause, perhaps an engine bug, or a corrupt cursor, or an oddity with a display driver, or something else.
It worked for me too but showing the cursor again failed. Once it was hidden, that's where it stayed. Resetting it didn't work until the bug got fixed in my custom engine build. Craig says it doesn't work in LC 9 but maybe it's in LC 10, though I don't recall seeing any mention in the release notes.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

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

Re: Hiding the cursor

Post by FourthWorld » Thu Jul 11, 2024 10:21 pm

In v9.x when I tested that here on a Mac unlocking the cursor restored normal behavior.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

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

Re: Hiding the cursor

Post by dunbarx » Thu Jul 11, 2024 11:02 pm

Jacque, Richard. Attached again are two stacks.

The first,"Wonky" shows the erratic behavior of a "hidden" cursor using only the two-liner in btn "Button" that you both seem to think works fine.

The second, "Insanity" shows an actual working hidden cursor from a handler in btn "Hide Cursor". This can change to watch in a two-line handler in btn "View Cursor". It also shows a five-line handler in the card script that is required to change the cursor to "arrow". Comment out lines 1 and 2 and it will not work.

The difference is in trying to revert directly to arrow. I could not do that. One can, however, go from "hidden" to any other cursor style, as long as it is not "arrow" or "hand'. To go from from "hidden" to either requires an intermediate step.

So there. :wink:

Craig
cursor insanity.livecode.zip
(1.13 KiB) Downloaded 164 times
WonkyCursor.livecode.zip
(874 Bytes) Downloaded 161 times

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

Re: Hiding the cursor

Post by FourthWorld » Thu Jul 11, 2024 11:37 pm

Thanks for making those. I'll take a look when I'm at a computer.

In the meantime, could you please tell us what LC and OS versions you're using?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

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

Re: Hiding the cursor

Post by FourthWorld » Fri Jul 12, 2024 6:36 am

dunbarx wrote:
Thu Jul 11, 2024 11:02 pm
Attached again are two stacks.
They both seem to work well here.
The difference is in trying to revert directly to arrow. I could not do that. One can, however, go from "hidden" to any other cursor style, as long as it is not "arrow" or "hand'. To go from from "hidden" to either requires an intermediate step.
I was able to bring back the arrow icon by using "unlock cursor" in the Message Box.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

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

Re: Hiding the cursor

Post by dunbarx » Fri Jul 12, 2024 2:59 pm

Richard.

So you have no jitter in the "Wonky" stack when the cursor is still in the rect of the button?

And you are able to simplify the two handlers in the "Insanity" stack. First the card script:

Code: Select all

on mouseUp
   --   set the defaultCursor to plus
   --   set the  cursor to plus
   set the defaultCursor to arrow
   set the  cursor to arrow
   lock cursor
end mouseUp
so that you can retrieve the arrow cursor as soon as the mouseLoc leaves btn "hide cursor" and click somewhere on the card.

And you are able to, say, change the cursor from "hand"to "watch" in btn "Hide Cursor":

Code: Select all

on mouseUp
   set the defaultCursor to watch --changed from "hand"
   set the  cursor to none
   lock cursor
end mouseUp
to make the cursor stable in all areas until you click somewhere, and with the "lock cursor" line uncommented?

I cannot do any of that. LC 9.6.9 Mac OS 13.4 Venturi.

Craig

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

Re: Hiding the cursor

Post by FourthWorld » Fri Jul 12, 2024 7:46 pm

Your latest reply suggests a level of specificity in perceiving the issue that I wasn't looking for. I saw the cursor change, it persisted, I noted that and went back to work. "Jitter" was not something I was looking for, and can mean different things.

The code also uses both lockCursor and defaultCursor properties, already clarified as designed to solve different needs.

So let's take this from the top:

Can you please describe what you want to do, and what you're seeing instead?

Can you try this using any script that doesn't mix the two global properties known to be designed different purposes?

Apparently I may be a bit slow on the uptake. Spell out the expected result and the actual result with enough detail that I can hone in on what you're experiencing.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

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

Re: Hiding the cursor

Post by dunbarx » Sat Jul 13, 2024 1:38 am

Richard.

None of this was for me. It started with the thread I referenced in my first post here. As you know, I will do anything that takes me away from my day job.

So from the top, I cannot right now. At home I am on LC 9.6.1 on an old laptop in OS 10.15.7 and all three stacks I posted in this thread are acting badly. They all have jittery cursors wherever I make, hide or move them.

Will get back to you next week back in 9.6.9 on a Mac Mini. But what machine are you on?

Craig

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

Re: Hiding the cursor

Post by FourthWorld » Sat Jul 13, 2024 8:23 am

dunbarx wrote:
Sat Jul 13, 2024 1:38 am
Will get back to you next week back in 9.6.9 on a Mac Mini. But what machine are you on?
Right now on a Mac M1 running macOS 12.6.3.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

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

Re: Hiding the cursor

Post by FourthWorld » Wed Jul 17, 2024 7:09 pm

dunbarx wrote:
Sat Jul 13, 2024 1:38 am
At home I am on LC 9.6.1...
Will get back to you next week back in 9.6.9...
While researching some other fixes I found this item in the Release Notes for v9.6.10:

"Problems with setting a cursor or setting the lockCursor when entering a control"
https://quality.livecode.com/show_bug.cgi?id=18428

Not sure if this relates to what you're seeing, but since both of your installs are earlier than this cursor change it may be worth updating to see if the new version helps.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply