move bug ?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
kevin11
Posts: 101
Joined: Thu Aug 11, 2011 5:02 pm

move bug ?

Post by kevin11 » Mon Aug 29, 2011 5:13 pm

oops, reposting here because I posted this into the wrong forum.....


I have an image that I can drag around the screen with a mouse (for my own very good reasons !)
When I release the mouse, I want the image to move back to the centre, but slowly.

I use :

move image "X" to 512,384 in 600 millisecond

95% of the time the image will move slowly as required.
5% of the time, it doesn't move, it snaps at high speed to the location,
and very, very occasionally, the image doesn't move at all.

If I use output messages I can see the command is indeed being called. Changing the number of milliseconds has no effect on the failure rate. If I use, for example, move image "X" to 512,384 in 1000 millisecond, it still snaps in 5% of the cases.
However, the image stays still for 1 second, before snapping. Increasing to say, 3000 ms, the image will mostly crawl back into position, but again, in 5% or so of the cases, it will sit still for three seconds and then snap.

It's as if in 5% of the case the move command is behaving more like the "set location" command. (and very rarely, the image won't move at all !)

This doesn't seem right to me.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7392
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: move bug ?

Post by jacque » Mon Aug 29, 2011 5:51 pm

If the engine is doing something else during those 600 milliseconds, the object may snap to position because it's "late" and needs to catch up. There could be background processes running (other apps or the OS) taking up a slice of time, or maybe the engine needs to load an image or an audio file, or redraw part of the screen, or just about anything else.

I'm not sure why it wouldn't move at all, I haven't ever seen that. Could your coordinates be off?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

kevin11
Posts: 101
Joined: Thu Aug 11, 2011 5:02 pm

Re: move bug ?

Post by kevin11 » Mon Aug 29, 2011 6:04 pm

Hi Jacque,

Thanks for the reply.

I'm running it on Windows XP. Nothing is happening in the background.
I thought about the cpu being busy elsewhere. However, the bug manifests itself even if I say take 3 seconds to do the slide. Mostly it will spend 3 seconds crawling back into place, sometimes it will sit still for three seconds and snap. I can increase the move time to 5 seconds or more and get the same random snapping. I can't see anything in the background that can hang the move for 200ms when I set the slide time to 200ms, and the same background process than hanging the slide for 5 seconds before allowing a snap. Of course on any platform there's always something going on in the background, but given that the freeze and then snap is independent of the slide-time I set, this implies it isn't the cpu being distracted.

The app isn't really doing anything else. It's a card that moves an image around as the mouse moves, and then should slide the image back to the centre. 95% of the time it will slide, 5% or so it will snap. The card isn't loading anything else or saving anything. It isn't dealing with any external files.

My coords aren't off, I have hardcoded the destination coords to centre the image.

I'm begining to wonder if it is not the image that is snapping, but rather the screen refresh isn't getting triggered when it should. If the screen refreshes late, it will look like the image has snapped. On the few cases where the image doesn't move at all, it may be the screen is not refreshing at all.

I will investigate this a bit more to try and ascertain where the problem lies.

Thanks

Kevin

Post Reply