Re: Determining left or right movement in a mouseMove handler
Thank you Mike Bonner, Mark Schonewille and Alejandre Tejada. I did work in the direction of Mike and Marks script but I forgot to use Local. That solved it. Alejandro I did not dig deep into your stack as the solution was ready at hand from Mike and Mark. But you can always us a bezier script. Thanks Im scripting a way to shuffle objects the visual way. Like when you move apps in the Mac dock. Has that been done before? Michael ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Determining left or right movement in a mouseMove handler
Hi Michael, This stack (and many other published stacks) have scripts for tracking mouseX and mouseY within a mousemove handler: http://andregarzia.on-rev.com/alejandro/stacks/newPentoolScript_v02.zip Al ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Determining left or right movement in a mouseMove handler
Hoping I didn't mix up the x's and y's, I believe the script you need looks like this: local myOldX,myOldY on mouseMove theNewX,theNewY if myOldX < theNewX then put "right" into myMovement else put "left" into myMoveMent end if if myOldY > myNewY then put "down" into myMoveMent else put "up" into myMoveMent end if // do something with right, left, // up and down here. put theNewX into myOldX put theNewY into myOldY pass mouseMove end mouseMove Kind regards, Mark Schonewille http://economy-x-talk.com https://www.facebook.com/marksch Buy the most extensive book on the LiveCode language: http://livecodebeginner.economy-x-talk.com Op 27-Jun-17 om 12:32 schreef Michael Kristensen via use-livecode: Hi there How can I determine if the mouse is moving left or right (or up or down) on the screen in a mouseMove handler? Not just from the outset (that is easy) but at any moment, like when a user changes his mind and move the opposite way. Something like put x into oldX will not work. Thanks Michael ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Determining left or right movement in a mouseMove handler
You do need to track the last location... here is a stack that does what you want. (script could be better i'm sure, but its a starting point.. ) https://www.dropbox.com/s/y6du5nmz5diiv0f/movedir.livecode?dl=0 Basically I put 4 square graphics on screen, top, bottom, right, and left position. Then used the following script.. local smX,smY on mousemove x,y --If the mouse hasn't moved yet, do the initial fill of the 2 script local variables smX and smY if smx is empty then put x into smx if smy is empty then put y into smy -- Compare the last x position to the current x position and color grc accordingly if smx > x then set the backcolor of grc "ltG" to blue set the backcolor of grc "rtg" to empty else if smx < x then set the backcolor of grc "ltG" to empty set the backcolor of grc "rtg" to blue end if -- same thing for y if smy > y then set the backcolor of grc "upG" to blue set the backcolor of grc "dng" to empty else if smy < y then set the backcolor of grc "upG" to empty set the backcolor of grc "dng" to blue end if put x into smx put y into smy end mousemove On Tue, Jun 27, 2017 at 4:32 AM, Michael Kristensen via use-livecode < use-livecode@lists.runrev.com> wrote: > Hi there > > How can I determine if the mouse is moving left or right (or up or down) > on the screen in a mouseMove handler? > > Not just from the outset (that is easy) but at any moment, like when a > user changes his mind and move the opposite way. > > Something like put x into oldX will not work. > > Thanks > Michael > ___ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode > ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Determining left or right movement in a mouseMove handler
Hi there How can I determine if the mouse is moving left or right (or up or down) on the screen in a mouseMove handler? Not just from the outset (that is easy) but at any moment, like when a user changes his mind and move the opposite way. Something like put x into oldX will not work. Thanks Michael ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode