Actually, the whole point of the "defaultcursor" is that it is *not* reset at
idle even without it being locked, whereas "the cursor" is reset at idle and
must be locked to be persistent. Setting the defaultcursor used to work over an
unlocked, editable field, but it doesn't any more. Checking the dictionary for
"defaultcursor":
"The defaultCursor is the shape used automatically when the mouse pointer is in
a stack window, but not in an editable field."
so apparently the behavior was changed for an editable field in some version <=
4.5 and I only noticed it now. Bummer.
Before I discovered the defaultcursor I did what André Bisseret suggested and
had a mousemove handler for locking and setting "the cursor" but I always ran
into problems with the cursor staying locked at random points. I always assumed
that the engine had missed firing off a mouseleave message -- I had put my
"unlock cursor" command in an "on mouseleave" handler. Then I'd be left with a
locked cursor and would have to unlock it via the messagebox. I could never pin
down a recipe for this.
André's/Eric's solution is similar to what I used before. I'll try it out again
and see if over time I still get stray locked cursors.
BTW, the handlers as you posted them, André, have a problem: once you hold down
the commandkey while moving over a word and the cursor changes to hand, it
won't change back when you lift the commandkey, until you move out of the
field. I revised Eric's mousemove handler accordingly (and note the addition of
a pass mousemove command at the end, in case individual fields have individual
mousemove behaviors):
on mouseMove
switch
case "button" is in the target
ShowHandCursor #
break
---====
case "field" is in the target
switch
case the commandkey is up
ResetCursor
break
case the lockText of the target is false
if the mousetext = empty then
ResetCursor
else if "link" is in the textStyle of the mouseChunk then
ShowHandCursor
end if
break
end switch
break
default
ResetCursor #
end switch
pass mousemove
end mouseMove
------------------------------
on mouseLeave
ResetCursor #
end mouseLeave
------------------------------
on ShowHandCursor
set the cursor to hand
lock cursor
end ShowHandCursor
------------------------------
on ResetCursor
unlock cursor
end ResetCursor
On Oct 12, 2012, at 12:31 PM, Bob Sneidar wrote:
> Lock the cursor first. If you don't, it will revert the first idle it gets.
> As someone mentioned use the cursor. Locking it will prevent the reversion
> you are seeing. (It actually is changing but so fast you can't see it.)
>
> Bob
>
>
> On Oct 12, 2012, at 6:06 AM, Peter M. Brigham wrote:
>
>> Anyone have an idea why this doesn't work? Put the following into the script
>> of an unlocked field:
>>
>> on mousemove
>> put the commandkey is down into cmK
>> if cmK then
>> set the defaultcursor to hand
>> else
>> set the defaultcursor to empty
>> end if
>> end mousemove
>>
>> I want the cursor to become "hand" with the commandkey down, but it simply
>> remains a bar over an unlocked field. I swear this used to work, but for
>> some reason it no longer does. 2008 MacBook, OSX 10.7.4 (Lion), Rev Studio
>> 4.5.3, build 1210
>>
>> -- Peter
>>
>> Peter M. Brigham
>> [email protected]
>> http://home.comcast.net/~pmbrig
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> [email protected]
>> Please visit this url to subscribe, unsubscribe and manage your subscription
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> [email protected]
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode