7
$\begingroup$

Bug introduced in 10.4 or earlier and persists through V11.2

[CASE:3993499]


If your UI contains a couple of heavy/big elements, or one heavy and couple of slightly heavy, because delay accumulates and you can't capture rendering finished event.

Please run the code sample

enter image description here

With addition to the delay issue, the second progress indicator does not appear at all. It is because FinishDynamic[] does not seem to care about the rendering time.

So if the second procedure starts before rendering of the first is finished, it will miss the progress indicator trigger.

This example is artificial but will affect your gui if it is a little bit more complex/heavy.

Question

Is there something like FinishRendering[]? Or how to queue procedures which involve noticeable rendering?

I will wait for WRI confirmation but for me it is a because:

FinishDynamic[] does not return until all Dynamic objects are updated and displayed.

- ref/FinishDynamic


(*in case evertyhing works well or FE crash, please modify `n` value.*)

DynamicModule[
  { processing1=False,processing2=False}
, data=panel1=panel2={}
; n=5 10^4
; update1[]:=panel1=Graphics[Line@data,Frame->True]
; update2[]:=panel2=Graphics[Line@data,Frame->True]
; Grid[{{
    Button["run me"
    , processing1=True              (* trigger the first progressindicator*)
    ; data=RandomReal[1,{n,2}]
    ; Pause[.1]                     (* artificial pause to mimic a time consumig `data` creation. allows to clearly see progress indicator*)
    ; update1[]                     (* create graphics *)
    ; processing1=False             (* trigger the first graphics to appear *)

    ; FinishDynamic[]               (* wait till everything is done *)

    ; processing2=True              (* analogous procedure for the second plot, fails *)
    ; Pause[.1]
    ; update2[]
    ; processing2=False
    , Method->"Queued"
    , ImageSize->100 {1,1}
    ]
  , Dynamic[
      If[processing1, Dynamic@ProgressIndicator[Appearance->"Indeterminate"],panel1]
    , TrackedSymbols:>{processing1}
    ]
  , Dynamic[
      If[processing2,Dynamic@ProgressIndicator[Appearance->"Indeterminate"],panel2]
    , TrackedSymbols:>{processing2}
    ]
  }}, BaseStyle->CacheGraphics->False
  ]
]

[CASE:3993499] was created

$\endgroup$
1
$\begingroup$

I'm still interested in workarounds / coding practices to deal with this issue.

Meanwhile, to take it off an unanswered stack, here is a confirmation from WRI Support:

[...] I do agree something is off here, [...] . I have filed a report with our developers asking that they identify the issue and look to address it.

If FinishDynamic is not meant to handle extra rendering time, I will file a suggestion that we create a FinishRendering function to handle cases like this. [...]

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.