Canvas.Paint not called after Window.Refresh

I have 12 canvases displaying previews of 12 graphs (out of dozens in a project). A scroll bar “scrolls” through the previews so that the next 12 are shown. To tell each canvas to update its image after a scroll, I call myWindow.Refresh, on the assumption that the entire window and its controls will be redrawn ie. all 12 canvases will get a Paint event and update themselves.

This works as expected under High Sierra, but with Mojave, none of the canvases get a Paint event (Invalidate has the same problem).

The only way to refresh the canvas pics under Mojave is to call each canvas with a myCanvas(j).Refresh.

I thought a window Refresh should take care of this. Am I doing something wrong? It does with HighSierra.

Xojo2021r1

Since Mojave macOS tries to be clever and just does what it want in regards to painting. Just give the canvases a refresh if macOS wants that. I only use refresh anyways.

I expect that this because of layer-backed views (a 3rd level of caching).
Try sending an invalidate message to each canvas.

Invalidate tells the canvas to refresh at the next available opportunity, where as refresh says update now. Invalidate is also coalesced, so you can call it a 100 times in a function, but it will only update once. Refresh will update the canvas a 100 times.

1 Like

OK got it thx. Both canvas refresh and invalidate work, bit I just assumed that if I wanted the entire window refreshed/invalidated, it is understood that includes its canvases. I guess not by Mojave.

Not when Apple’s triple buffering is involved no. You used to have to enable this, but as things change it sorta became auto-enabled under various circumstances and now I think it is on by default.