Page 1 of 3

What is up with "lock Cursor"?

Posted: Wed May 08, 2024 2:30 pm
by dunbarx
This derived from a thread about cursors. I almost never use the "cursor" property.

But I do not understand why, in a new stack with a single button, in the button script:

Code: Select all

on mouseUp
   set the cursor to watch
   lock cursor
end mouseUp
The cursor only is watch while within the rect of the button itself. It reverts to arrow if I move out of the button rect. If instead I place that handler in the card script, then the cursor is a watch unless I enter the rect of the button. It cannot be so, but this test seems to indicate that when one changes the cursor, even if locked, it only retains its new form while within the rect of the initial object it was made.

I know so little of LC. :(

Craig

Re: What is up with "lock Cursor"?

Posted: Wed May 08, 2024 2:43 pm
by dunbarx
It seems that changing the cursor is meant for running handlers, not just general cursor "styles".

But is there no way to simply have ones own cursor for general use?

Craig

Re: What is up with "lock Cursor"?

Posted: Wed May 08, 2024 2:57 pm
by richmond62
Dunno: this works:

Code: Select all

on mouseUp
   set the cursor to 1003
   set the lockCursor to true
end mouseUp
-
Screenshot 2024-05-08 at 16.53.44.jpg
-
Clicking on the 'Paw', and away you go.

Re: What is up with "lock Cursor"?

Posted: Wed May 08, 2024 3:01 pm
by richmond62
This works equally well with mouseEnter in the field script.

Re: What is up with "lock Cursor"?

Posted: Wed May 08, 2024 4:26 pm
by FourthWorld
dunbarx wrote:
Wed May 08, 2024 2:43 pm
It seems that changing the cursor is meant for running handlers, not just general cursor "styles".

But is there no way to simply have ones own cursor for general use?
See the defaultCursor global property.

Re: What is up with "lock Cursor"?

Posted: Wed May 08, 2024 5:07 pm
by dunbarx
Richard.

Yep, that does it, thanks. Do not remember that at all. The dictionary ought to at least mention it in related "cursor" entries.

Craig

Re: What is up with "lock Cursor"?

Posted: Wed May 08, 2024 5:09 pm
by dunbarx
Richmond.

Your "paw" changes as soon as the cursor leaves that image. That is what I wrote about initially.

Craig

Re: What is up with "lock Cursor"?

Posted: Wed May 08, 2024 5:16 pm
by dunbarx
Richmond.

Just downloaded your second stack. Nope.

Again, the issue is that the cursor property cannot be used if one expects it to stick as the user navigates around the card. Richard really points out that, counterintuitively (at least to me) the "cursor" property, along with "lock cursor", is not the one I expected it to be. Rather, the "defaultCursor" is.

The "cursor" property works fine in certain cases, and on occasion I have used it this way. For example, in a button script:

Code: Select all

on mouseup
set the cursor to watch
lock Cursor --but not necessary
wait until the mouseClick
end mouseUp
The watch sticks because a handler is still running. This does not relate to a "general purpose" browser cursor.

Craig

Re: What is up with "lock Cursor"?

Posted: Wed May 08, 2024 5:23 pm
by richmond62
Your "paw" changes as soon as the cursor leaves that image.
Well, over here, with LC 9.6.3 the 'paw' remains a paw across the card and those 'random' objects I sprinkled across the card.

Unfortunately the screen shot thingy in MacOS, even when 'show the pointer' is selected, does NOT show any cursor whatsoever.

Re: What is up with "lock Cursor"?

Posted: Wed May 08, 2024 5:44 pm
by richmond62
Well that took a bit of fiddling around with some third-party software, but here we are:
-
Screenshot 2024-05-08 at 19.41.50.jpg
-
My 'paw' remains a paw through out the IDE.

Re: What is up with "lock Cursor"?

Posted: Wed May 08, 2024 6:46 pm
by dunbarx
Richmond.

Are on linux? For me, only the global "defaultCursor" will allow me to keep whatever cursor I chose using the browse tool.

Surely the platform cannot have that sort of difference.

Craig

Re: What is up with "lock Cursor"?

Posted: Wed May 08, 2024 6:55 pm
by jacque
The cursor resets on idle if "lock cursor" is used. The defaultCursor replaces the arrow throughout -- usually. In a standalone you're pretty safe but in the IDE sometimes the LC cursor takes over again if you focus on an LC stack like the script editor and then go back to the mainstack.

There was a cursor bug for some time where lock cursor didn't work correctly, which was fixed recently. If you want a permanent fix without any scripting then you can replace the cursor images in the revCursors stack. Once that's done you'll have to drag the edited stack into any new version you download, replacing the default one.

Re: What is up with "lock Cursor"?

Posted: Wed May 08, 2024 7:00 pm
by richmond62
Richmond.

Are on linux?
Not currently: MacOS.
you can replace the cursor images in the revCursors stack
I believe they have to be PDF images.

Re: What is up with "lock Cursor"?

Posted: Wed May 08, 2024 9:21 pm
by jacque
richmond62 wrote:
Wed May 08, 2024 7:00 pm
I believe they have to be PDF images.
No, just standard PNG, black and white, and a third color marked as transparent.

I should correct myself, the lock cursor command is supposed to last across handlers until it is unlocked, but a bug broke that until it was fixed recently, I think it was in LC 9.6.9.

Re: What is up with "lock Cursor"?

Posted: Wed May 08, 2024 11:13 pm
by dunbarx
Jacque.

I do not think so. My test stack has a button with:

Code: Select all

on mouseup
   set the cursor to watch
   lock cursor
   --wait until the mouseClick-- with messages
end mouseUp
Clicking on the button changes the cursor. But moving that cursor out of the rect of the button reverts to the standard arrow. I am in LC 9.6.9.

It feels like a bug to me, and the dictionary would agree:
Use the lock cursor command to make the cursor retain a specified appearance until you change it
That certainly implies to me that I must change it, not that it changes itself. If I uncomment the "wait" line, then the handler is still "running", and only another mouse click will release the watch.

Craig