Annoying flicker of controls on a scrolling canvas

Hi
I have a long horizontal canvas1 that is scrolled to view just like those windows store apps using a scrollbar.
the canvas is set with
a backdrop
Canvas1.EraseBackground = False
Canvas1.DoubleBuffer = True

when I scroll the canvas and the part that contains a label set as transparent comes into view slowly it flickers, ie shows a bit of its white background on and off.
This happens with text field controls also.
I am using Windows 8.1 Xojo 2015r3
any hints to eliminate this effects?

[quote=226625:@Chris Salonikas]Hi
I have a long horizontal canvas1 that is scrolled to view just like those windows store apps using a scrollbar.
the canvas is set with
a backdrop
Canvas1.EraseBackground = False
Canvas1.DoubleBuffer = True

when I scroll the canvas and the part that contains a label set as transparent comes into view slowly it flickers, ie shows a bit of its white background on and off.
This happens with text field controls also.
I am using Windows 8.1 Xojo 2015r3
any hints to eliminate this effects?[/quote]

Have you tried without double buffering ? If the canvas is simply used as container, it is not necessary.

Also, when a canvas is used a container, nothing should be placed in Paint.

Yes, I use it as a container and I have nothing in Paint.
No difference, still flicker.
Even if I scroll slowly
A lesser effect when I use the arrows of the scrollbar to scroll instead of the mouse wheel.

Michel, tried to contact you privately but that option is not given on the mobile site of this forum:

I see you often wuote the original post entirely. Apart from being unnecessary, it alao makes the forum harder to read due to the additional clutter. Maybe could could not quote the entire msgs so often?

Sorry, did not think of tiny screens.

I played with a very simple project with a label and a TextField over a Canvas. In the Canvas MouseWheel, I only had :

me.Scroll(DeltaX, DeltaY)

No flicker, but the label was getting smudged.

Then I added me.Invalidate, and flickering was there.

I finally found a nice scroll and a correct label with

me.Scroll(DeltaX, DeltaY) Label1.Invalidate

I am using Windows 10 which is somewhat less flickery than previous versions,

Another improvement can be to avoid unnecessary redraws by scrolling only once per 1/60th a second :

static previoustick as double = ticks if ticks <> previoustick then me.Scroll(DeltaX, DeltaY) Label1.Invalidate end if

Thanks Michel, I will try this.

I forgot to reset previousTick. Sorry.

Here :

static previoustick as double = ticks if ticks <> previoustick then me.Scroll(DeltaX, DeltaY) Label1.Invalidate previoustick = ticks end if

Thanks Michel,

As it turned out the flicker occurs even on the backdrop with no controls just horizontal scrolling canvas with a backdrop
I tried gif, png and jpeg backdrop, all flicker, more pronounced at the border of the colour change as the scroll prograsses.
The backdrop is a long plain picture with stripes of different colour as in the windows apps.
Maybe it is the windows 8. I will be upgrading to 10 eventually.

[quote=226853:@Chris Salonikas]Thanks Michel,

As it turned out the flicker occurs even on the backdrop with no controls just horizontal scrolling canvas with a backdrop
I tried gif, png and jpeg backdrop, all flicker, more pronounced at the border of the colour change as the scroll prograsses.
The backdrop is a long plain picture with stripes of different colour as in the windows apps.
Maybe it is the windows 8. I will be upgrading to 10 eventually.[/quote]

It gets difficult to figure out what you are trying to obtain. How are you scrolling the backdrop image ? Is it a full screen window ?

There really isn’t a good solution to this problem at this time. You could get your backdrop to scroll smoothly by drawing it yourself in Paint, but as soon as you add controls on top of it, you’ve got flicker.

Here is another way.

Instead of scrolling the canvas, it is placed onto a ContainerControl.

Then the MouseWheel event of the window simply changes the Left of the canvas onto the Container Control. I have not built much in there, but it seems flicker is reduced to a minimum. Some controls flicker more than others, such as oval, which seems to hesitate between circle and square during the scroll. I have multiplied DeltaY by 10, to obtain the kind of speed common in for instance the Windows Store.

ScrollW.zip

Is flicker something that could be fixed in the Xojo framework, or does the problem rest solely in Windows itself?

Problem One: Windows window drawing isn’t double buffered. Mac and Linux are by default.

Problem Two: Native Win32 controls will generally flicker when something is underneath them. What MS has done, if I recall correctly, to eliminate the flicker is to double buffer the drawing of the controls.

And one and two together and you get some nasty flickering.

So both problems are really Microsoft’s but we all expect Xojo to fix it. At one point there was some talk about using .NET libraries (which does double buffering) which is now available on all supported Windows platforms (XP was the holdout) to fix this. No idea how far that’s gone or timeframe if it’s been approved.

Keeping my fingers crossed for 2016!

Xojo uses Win32, which is the oldest Windows framework. That framework does not use double buffering, except for Canvas, and yet, with loss of transparency. Intrinsically, it is the same framework as the early versions of Windows from the mid eighties. Archeology. Like if recent Macs were still using the Rom from the Mac Plus…

Since Windows XP SP1 back in 2002, Microsoft added .NET framework support as standard (we are not getting any younger). Among other things, that framework provides double buffering for all display, analogous to what the Mac is getting by hardware. It is just as smooth.

It is sad that Real Software never got around in all these years to implement .NET. I guess they had their arms full with Cocoa.

Today, Windows New API UWP apps are using a third framework, introduced with Windows 8 to support both desktop and mobile. That new API is itself based largely on .NET.

I do hope Xojo Windows eventually supports .NET. Sooner would be preferable to never.

You may want to support this feature request, now 6th : <https://xojo.com/issue/28733>

Just added it to my top list, thanks for pointing this one out!

Don’t squeeze them to tight :slight_smile: - this has been a known thing/issue/feature for many years; no indication 2016 (or 17, or 18) will be any different.

To be honest do not see Xojo using .NET for windows in the next years. How big the user base for
windows? Although Xojo is cross-platform, I am inclined to say most ppl develop for Mac.

This thread is about Windows development. Please let Windows developers voice their hopes for a better Xojo support. No need for putting down the lesser child once again.