dezsoe wrote:sebmay wrote:i read somewhere that there may be a delay between the code or codesync until issmoving is actually raised. Is it true ?
I really can't imagine, but we'll have to wait for Balázs to get the exact answer.
I was thinking wrong and you are right if you call Code. There are two possibilities:
1. If you call Code, the execution comes back to your program and there can be a delay before ismoving() gets true.
2. If you call
Codesync, the execution comes back only when the code is compiled and sent to the motion buffer. When something gets into the buffer, the ismoving() will return true.
So, if you want to do the right way then you create a new thread and there you call
Codesync and wait for !ismoving(). Do not call
Codesync from the UI thread, because it can freeze the whole GUI. And, because you called a new thread, you don't even need to call DoEvents().