F
Fox12
Hi, Gurus,
I need to develop a program which contains about 300 hundreds of shapes.
Each shape will rotate 1 degree when its associate value changes. I use a
library function, which in turn fires a call-back function to retrieve the
value from a remote server, for that value. While there are only a few
shapes, it works fine. The code snippet like below:
For I = 1 To iShapeCount
If Not (shapesObj.Item(I).Data1 = "") Then
Call RotateShape(shapesObj.Item(I))
PAUSE 1 second ''''''don't say this line
is wrong, it just shows you that the code will pause a second here
End If
Next I
When I increase the number of shapes, the shapes starts to mess up its
rotation. Some shapes whose values do not change also rotate. That is
wrong. I used a "pause" function to slow down the loop. It works well
again.
Now the number of shapes exceeds 200 hundred, and the rotation messes up
again. I expect it to continue to increase to 300+.
My understanding is that because the loop may run too fast and the call-back
function may not have return a value yet. My question is how I can make
sure that the call-back function has returned a value before the loop
continues.
Is a multi-threading a solution to this problem? Is there a "LOCK" function
available so that I can lock the RotateShape function?
Any of your suggestions is appreciated.
Fox12
I need to develop a program which contains about 300 hundreds of shapes.
Each shape will rotate 1 degree when its associate value changes. I use a
library function, which in turn fires a call-back function to retrieve the
value from a remote server, for that value. While there are only a few
shapes, it works fine. The code snippet like below:
For I = 1 To iShapeCount
If Not (shapesObj.Item(I).Data1 = "") Then
Call RotateShape(shapesObj.Item(I))
PAUSE 1 second ''''''don't say this line
is wrong, it just shows you that the code will pause a second here
End If
Next I
When I increase the number of shapes, the shapes starts to mess up its
rotation. Some shapes whose values do not change also rotate. That is
wrong. I used a "pause" function to slow down the loop. It works well
again.
Now the number of shapes exceeds 200 hundred, and the rotation messes up
again. I expect it to continue to increase to 300+.
My understanding is that because the loop may run too fast and the call-back
function may not have return a value yet. My question is how I can make
sure that the call-back function has returned a value before the loop
continues.
Is a multi-threading a solution to this problem? Is there a "LOCK" function
available so that I can lock the RotateShape function?
Any of your suggestions is appreciated.
Fox12