12

Bug introduced in 8 or earlier and persists through 11.3


Consider the following MWE:

CreateDocument[
 DynamicModule[{x = {500, 500}},
  Framed[
        "test"
   , ImageSize -> Dynamic[Print[RandomReal[]]; x, TrackedSymbols :> {x}]
   ]
  ]]

The resulting notebook prints streams of numbers when you are changing it's window size. It is not expected since x is not connected to "WindowSize" option or CurrentValue.

If you nest more such Frames you can see ugly effect of notebook scrollbars position delay in reference to notebook frame.


Confirmed bug. Can't be fixed in 10.0.2 so we have to wait for next release. ($WolframNext)

Kuba
  • 136,707
  • 13
  • 279
  • 740

1 Answers1

5

I also consider this an unacceptable bug. Nevertheless I wanted to share a workaround which I think avoids the problem but is unfortunately a lot of effort to add to more complicated cases:

CreateDocument[
    DynamicModule[{x={500,500},lastValue},
        Framed[
            Slider[Dynamic[x[[1]]],{400,600}],
            ImageSize->Dynamic[
                If[x=!=lastValue,lastValue=x;Print[RandomReal[]];x,x],
                TrackedSymbols:>{x}
            ]
        ]
    ]
]

Note: my originial answer did actually answer a different question, the code shown here is an adapted version of the workaround provided by Kuba.

Mr.Wizard
  • 271,378
  • 34
  • 587
  • 1,371
Albert Retey
  • 23,585
  • 60
  • 104
  • Yes ;) I did this because sometimes people don't go below first answer. Now everything what's important is scanned in a glimpse ;) – Kuba Feb 20 '15 at 08:39