Unexpected result with Set Points & Set Rectangle
Posted: Tue Oct 27, 2015 10:11 pm
Hi
I'm getting a result that I don't expect when setting the points of a graphic and setting the rectangle of the same graphic.
My stack is as follows -
Stack
Card1
On PreOpenCard
Set the rectangle of graphic "ABC" to 0,0,200,200
Put Empty into field "DisplayPoints"
End PreOpenCard
Graphic "ABC" // Type = line, and EMPTY OF POINTS ON STARTUP
Button1
on mouseUp
set the points of graphic "ABC" to the points of graphic "ABC" & cr & 100 & comma & 100
Set the rectangle of graphic "ABC" to 0,0,200,200 // same as on the PreOpenCard
Put the points of graphic "ABC" into field "DisplayPoints"
end mouseUp
Field DisplayPoints // Only purpose is to list the points of graphic ABC (so that we can see what is happening)
Note that the points that I add and the the set rectangle instruction are both constant.
I'm expecting that after three presses of Button 1, I will see the following in field DisplayPoints
100,100
100,100
100,100
Growing by another "100,100" with each push of the button.
But instead what I'm getting is:
1) An initial 100,100 (all good so far)
2) Which on the second press of the button gets overwritten by
1,1
199,199
3) And after that I get a 100,100 added with each push of the button.
4) So that after 10 pushes of the button I've got
1,1
199,199
100,100
100,100
100,100
100,100
100,100
100,100
100,100
100,100
I don't understand why I'm getting those first two values, when both the points that I'm adding and the "Set Rectangle" that I'm using never change.
Any advice would be much appreciated.
I'm getting a result that I don't expect when setting the points of a graphic and setting the rectangle of the same graphic.
My stack is as follows -
Stack
Card1
On PreOpenCard
Set the rectangle of graphic "ABC" to 0,0,200,200
Put Empty into field "DisplayPoints"
End PreOpenCard
Graphic "ABC" // Type = line, and EMPTY OF POINTS ON STARTUP
Button1
on mouseUp
set the points of graphic "ABC" to the points of graphic "ABC" & cr & 100 & comma & 100
Set the rectangle of graphic "ABC" to 0,0,200,200 // same as on the PreOpenCard
Put the points of graphic "ABC" into field "DisplayPoints"
end mouseUp
Field DisplayPoints // Only purpose is to list the points of graphic ABC (so that we can see what is happening)
Note that the points that I add and the the set rectangle instruction are both constant.
I'm expecting that after three presses of Button 1, I will see the following in field DisplayPoints
100,100
100,100
100,100
Growing by another "100,100" with each push of the button.
But instead what I'm getting is:
1) An initial 100,100 (all good so far)
2) Which on the second press of the button gets overwritten by
1,1
199,199
3) And after that I get a 100,100 added with each push of the button.
4) So that after 10 pushes of the button I've got
1,1
199,199
100,100
100,100
100,100
100,100
100,100
100,100
100,100
100,100
I don't understand why I'm getting those first two values, when both the points that I'm adding and the "Set Rectangle" that I'm using never change.
Any advice would be much appreciated.