❔ Failing in breaking for loop
I cannot break out of for loop, somehow
So, since moment of calling Event1 is unknown, it might interfere with MovementManager, so, I need it to break the for loop if needed, and then proceed to call MoveForm that is in Event1. Any suggestions how to fix this? Any idea why
break
doesn't work here?18 Replies
Break works
That's just not up for debate
That's interesting since it does not work, let me open obs rq
Why are you calling MoveForm when you're trying to stop it?!
Because I can't have it 2 running in the same time, so I need to end first, then start second
Ok, so these must be running on different threads then ...
They cannot
Because they will try to change position of form in the same time, which will result in jittering
Here, it stops for a second, then just continues going, which means, the loop wasn't broken
But instead it should stop for a second, and go to bottom right corner
The one way that setting stop moving=true can affect the loop from another method before it runs the next line is if the other Move Form is started from another thread
My guess, it is started from another thread, because one is a thread that I created, second, is created by vs I guess? Because it's a looking for a click
So I have 2 threads cool
But shouldn't, in this case, give it a jittering like result? Like if it would go 2 ways at once, instead of just continuing?
Probably one location = temp Point just gets ignored as they're both dispatched to the UI thread
That's possible
My advice is remove the loop with the sleep, use a timer event instead
You can start/stop the timer
I mean, that could work, but I'm unsure if it's a good approach, since I'm just trying to apply values of calculations I did before in time period
But will definitly try it, I'm desperate for something that will work
Using sleep is definitely a bad approach
Yeah
That is what the timer is for
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.