Accursed cursors

All flavors welcome.
Forum rules
Be kind.
Post Reply
User avatar
richmond62
Posts: 4832
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Accursed cursors

Post by richmond62 »

This:
on mouseEnter
set the lockCursor to true
set the cursor to (the ID of image "SR" of card "DEPOSITORY")
end mouseEnter

on mouseLeave
set the lockCursor to false
set the cursor to 0
end mouseLeave
as a fieldScript does a fine job of converting the cursor to my bespoke cursor inwith the field: but, on
leaving the field I end up with an invisible cursor.

If, however I use this script:
on mouseEnter
set the lockCursor to true
set the cursor to (the ID of image "SR" of card "DEPOSITORY")
end mouseEnter

on mouseLeave
set the lockCursor to false
set the cursor to arrow
end mouseLeave
on leaving the field I end up with a hand cursor.
https://richmondmathewson.owlstown.net/
User avatar
richmond62
Posts: 4832
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Accursed cursors

Post by richmond62 »

This:
The built-in cursors and their recommended uses are:

none: Hides the cursor
busy: Use repeatedly during a long handler
watch: Use during a moderately long handler
arrow: Use for selecting objects
cross: Use for painting, drawing, or selecting a point or small area
hand: Use for clicking hypertext links
iBeam: Use for selecting text in a field
plus: Use for selecting items such as spreadsheet cells
help: Use for getting online help
https://livecode.fandom.com/wiki/Cursor

doesn't make much sense in application.
https://richmondmathewson.owlstown.net/
User avatar
OpenXTalkPaul
Posts: 2633
Joined: Sat Sep 11, 2021 4:19 pm
Contact:

Re: Accursed cursors

Post by OpenXTalkPaul »

richmond62 wrote: Thu Aug 22, 2024 4:56 pm
on mouseEnter
set the lockCursor to true
set the cursor to (the ID of image "SR" of card "DEPOSITORY")
end mouseEnter

on mouseLeave
set the lockCursor to false
set the cursor to arrow
end mouseLeave
on leaving the field I end up with a hand cursor.
I know 'the cursor' syntax may not be very intuitive, but you have to set the cursor first, and THEN lock the cursor. While the cursor is locked, you cannot change it. So just swap the order of those lines and it should work.

Code: Select all

on mouseEnter
   set the cursor to (the ID of image "SR" of card "DEPOSITORY") 
   set the lockCursor to true
end mouseEnter 

on mouseLeave
   set the lockCursor to false -- unlock to allow changing the cursor
   set the cursor to arrow -- change the cursor
   set the lockCursor to true -- lock again to disallow changing the cursor (but only while cursor is within a stack window)
end mouseLeave
You may also want to have handlers for 'on exitFeild','closeField','dragLeave' (if allowDrop is on), 'on focusOut','on mouseWithin' (only sent when in user 'Browse' Mode), 'on tabKey' (if you use tab to exit a field), and of course your scripts can check 'the mouseControl' at any time. You might also check on mouseRelease. You could also add the checking to the card or to a group that the fld is in.

Certain objects may automatically force the cursor to change temporarily, like unlocked text fields may change to the I-beam automatically when you mouse over them.

Remember, you can additionally set 'the defaultCursor', which is slightly different then setting 'the cursor'.
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests