Following is a code fragment. I am updating a rectangle using a for loop when a button is pressed. This is a model for my ultimate intention of showing visualization of data model as it changes large number of times inside a for loop. It works but I see only one change. Now since I am changing the width randomly I should see large number of changes. It seems I am making a wrong assumption on something basic.
The code goes below:
7 var rec: Rectangle = Rectangle {
8 x: 10, y: 10
9 width: 140, height: 90
10 fill: Color.BLACK
11 }
12
13 Stage {
14 title: "MyApp"
15 scene: Scene {
16 width: 200
17 height: 200
18 content: [
19 rec,
20 Button {
21 text: "Button"
22 action: function () {
23 for (i in [1..999]) {
24 rec.width = 25 + java.lang.Math.random()*50;
25 }
26 }
27 }
28 ]
29 }
30 }