Wait until the move is done(?)

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
rumplestiltskin
Posts: 223
Joined: Wed Jun 21, 2006 7:33 pm
Contact:

Wait until the move is done(?)

Post by rumplestiltskin » Wed Nov 20, 2013 5:47 pm

I've got a handler that does this:

move graphic "ball" to 300,300 in one second
--then we do other things

The problem is that the "other things" start before the move is complete. I tried adding "wait 1 second" after the first line of code but that seems to freeze everything so you don't see the object move properly and the other things (that do some more movement) don't work properly because the position of the object isn't where it should be. So I'm looking for the equivalent to "wait until the move is done", as in:

move graphic "ball" to 300,300 in one second
wait until the move is done
--then we do other things

Any suggestions welcomed!

Thanks,
Barry

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Wait until the move is done(?)

Post by Klaus » Wed Nov 20, 2013 6:23 pm

HI Barry,

you do not need to do anything!
...
move graphic "ball" to 300,300 in one second
put "Done"
...
"Done" will appear in the message box AFTER the graphic has stopped.
Just tested, that is "normal" behavior :D

If you want to continue the script immediately after the object starts moving, add this:
...
move graphic "ball" to 300,300 in 1 secs WITHOUT WAITING
put "Done"
...
"Done" will appear immediately in the message box.


Best

Klaus

rumplestiltskin
Posts: 223
Joined: Wed Jun 21, 2006 7:33 pm
Contact:

Re: Wait until the move is done(?)

Post by rumplestiltskin » Wed Nov 20, 2013 6:25 pm

Klaus,

Thanks. However, what I need to do is wait until the object has finished moving before the script continues.

Barry

edit: If I leave off the "without waiting", that should do it?
Last edited by rumplestiltskin on Wed Nov 20, 2013 6:26 pm, edited 1 time in total.

chris25
Posts: 354
Joined: Tue Oct 08, 2013 9:32 pm

Re: Wait until the move is done(?)

Post by chris25 » Wed Nov 20, 2013 6:25 pm

I created a start button and two extra buttons and then put this code into the start button:

on mouseup
move button "b1" from 200,250 to 250,300 in 2 seconds
wait 2 seconds
move button "b2" from 200,250 to 350,400 in 2 seconds
end mouseup
I do not know if this helps if you compare it with anything you have done, but it worked as expected. Hope I have not misunderstood you.

kind regards
chris

rumplestiltskin
Posts: 223
Joined: Wed Jun 21, 2006 7:33 pm
Contact:

Re: Wait until the move is done(?)

Post by rumplestiltskin » Wed Nov 20, 2013 6:35 pm

Yes, all I needed to do was leave off the "without messages" and that resolved it.

move graphic 1 to 300,300 in 1 second
wait .2 seconds -- just so the user sees the object has, indeed, been moved back to the starting point before moving it again.
rest of stuff gets done

Thanks Klaus and Chris! As is usual, all I needed to do was have a few sets of new eyes to help clarify this.

I-am-not-worthy...

Barry

chris25
Posts: 354
Joined: Tue Oct 08, 2013 9:32 pm

Re: Wait until the move is done(?)

Post by chris25 » Wed Nov 20, 2013 6:38 pm

neither am I....but getting others to disagree with you helps....

Post Reply