Cursor woes

Peter M. Brigham, MD pmbrig at gmail.com
Fri Aug 12 08:39:48 EDT 2011


I much prefer never to lock the cursor -- it tends to stay locked at odd moments. Instead try setting "the defaultcursor."

The problem of your cursor changes not happening as expected probably comes down to where the script is -- it may not be in the message path for some reason, maybe you are trapping mousemove in some individual controls, etc. One approach is to use a frontscript:

Put these in the script of card 1 of your standalone main stack

on openstack
   insert the script of btn "myFrontScript" of stack "someStack" into front
   pass openstack
end openstack

/*
If you're working in the IDE, you might want to put this in the same place, so the frontscript down't persist when you move on to other projects:

on closestack
   remove the script of btn "myFrontScript" of stack "someStack" from front
   pass closestack
end closestack
*/

Script of btn "myFrontScript":

on mousemove
   if "button" is word 1 of the target then
      set the defaultcursor to hand
   else
      set the defaultcursor to empty
   end if
   pass mousemove -- important!
end mousemove

-- Peter

Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig


On Aug 12, 2011, at 2:37 AM, FlexibleLearning wrote:

> Looks like 2 issues here. First getting the cursor to stick; second getting
> the correct cursor display.
> 
> Lock/Unlock cursor should resolve the first; importing and using your own
> cursor image should resolve the second.
> 
> local cHand=999100
> local cArrow=999101
> 
> on mouseEnter
>  if "button" is word 1 of the target then
>    set the cursor to cHand
>  else set the cursor to cArrow
>  lock cursor
> end mouseEnter
> 
> on mouseLeave
>  unlock cursor
>  pass mouseLeave
> end mouseLeave
> 
> 
> Hugh Senior
> FLCo
> 
> ------------------------------------
> Chip Thomas wrote:
> 
> Having some trouble changing the cursor, and hope someone can help shed some
> light on the topic.
> 
> I have a "mouseEnter" script on the main card that checks if the target is a
> "button".  If it's a button, it sets the cursor to hand.  If not, it sets it
> to arrow.
> 
> I've tried implementing this in two different projects.
> 
> One project is a launcher system where the standalone just launches a
> separate main stack file.  The cursor script is on the card of this stack
> file.  In this project, I don't get any cursor changes except when in the
> development environment.
> 
> The second project is just a regular standalone with the cursor script on
> the main card of the standalone.  I do get a cursor change, but I get a
> watch rather than a hand.
> 
> Argh!  Any help would be much appreciated.
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the Use-livecode mailing list