Jump to content
Tom F

Flash when showing form with VCL Styles

Recommended Posts

Enabling styles in our D11 app results in a flash when we open sub-forms.  

The only discussion I've found on this is here, but the solutions discussed there dont' work for me.

 

Any suggestions on how to eliminate the flash.

 

Example of flash:

 

 

Share this post


Link to post

I had a similar issue.   If I remember well, setting the ParentBackground property to true for all controls helped, although I see in the previous thread that @Uwe Raabe claimed the opposite.

 

There was such an issue https://quality.embarcadero.com/browse/RSP-31158 that is supposed to be fixed in D11.   See also the related issues to this one.

 

See also TStyleManager.UseParentPaintBuffers introduced in D11.   I have not tried it and there is limited documentation.

Edited by pyscripter
  • Thanks 1

Share this post


Link to post

There have been multiple conversations about flickering over the last few releases...there might be multiple issues still needing to be addressed but here are a few: 

Error in VCL TWinControl.WMEraseBkgnd causes flickering  https://quality.embarcadero.com/browse/RSP-24415

VCL Themes - Flicker when resizing   https://quality.embarcadero.com/browse/RSP-30639

 

They have fixed a number of issues, like this one: https://quality.embarcadero.com/browse/RSP-31158

Share this post


Link to post

Thanks, @Darian Miller.

 

In my opinion, Delpih Styles is worse than worthless as long as the flicker is there. 

 

If my software exhibited this kind of flicker, it would be laughed at by our customers. There's no way I use Styles as long as this defect continues to exist.

 

I'm disappointed that EMB would pretend that this feature works.

 

Share this post


Link to post

Many have struggled with VCL Styles since they were introduced.  They may work in simple cases, but I have personally lost a number of hours of dev time due to this issue.

 

I would try to set the .UseParentPaintBuffers property to True and re-test your style flicker.  There is a little info on it at the bottom of this page:

https://docwiki.embarcadero.com/RADStudio/Sydney/en/VCL_Styles_Support_for_High-DPI_Graphics

 

 

  • Like 1

Share this post


Link to post
9 hours ago, Tom F said:

Any suggestions on how to eliminate the flash.

Flicker in VCL Styles can have many root causes depending on the controls used and their settings. It is hard to tell what exactly causes it here and how to fix it. It seems like here it is caused by a form (or whatever control you have as a main container) clearing its canvas with white (default) color before painting dark style. 

 

First step would be to check all combinations of various settings on both form and other controls (especially if you have another container control that host other controls) (you may want to create simple test project for that) like ParentBackground, DoubleBuffering,... Also setting explicit background color to the dark one could help but that would also require adjusting StyleElements and removing seClient from them. 

 

If that does not work then another way would be to start playing with WM_ERASEBKGND messages in a container control (frame or panel) that is not styled. Fix mentioned in RSP-24415 has some issues on Windows 11 and non styled controls like combo boxes (I haven't tested with styled ones) that are not properly refreshed and they need their repainting and erasing tweaked. 

 

It is possible that you will be able to find some satisfactory fix by simple property changes and figuring out proper combination for that form, but it is also possible that fix would require more complicated hacks. 

Share this post


Link to post

My advice is related to styles that have a TPanel with a solid color. This rules out scenarios where a form wide image or pattern is visible as a (semi-)transparent background. If a TPanel is drawn in a solid color anyway, there is no benefit from drawing its parent background first. Thus setting ParentBackground to false omits some of teh drawing completely. It also helps when the form gets a full client TPanel containing all other controls to omit drawing that form client area on each paint event. With these simple steps we reduced flicker from highly annoying to no more perceptible.

Edited by Uwe Raabe

Share this post


Link to post

Thanks for your helpful feedback @Dalija Prasnikar @Uwe Raabe @Darian Miller.and others.

 

I created a tiny test program that has the same flashing problem on the main form and subform.

 

I tested it on another machine, and on a VM on my machine and there's no flashing!  WTF?!

 

I updated all my monitor drivers and the problem remains on my computer. 

 

It's hard to know how frequent or rare this problem will be in the field.   ¯\_()_/¯

 

I'm going to post the source in a new thread and ask for members to download, compile, and test.

 

Thanks again for taking the time to respond to my OP and for all your contributions to our community.

Tom

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×