Page 1 of 1

Dark skinned application that flashes when started

Posted: Thu Jul 19, 2018 8:11 am
by bertolino
Hi, I am developing a dark "skinned" application with buttons, check boxes, ... each derived form wxPanel or wxWindow. Everything works fine but when the application starts and the main frame is displayed, all the skinned objects flash once (it's very fast) as white rectangles just before been displayed correctly. The same thing happens whith the interior of a pane (of a wxAuiManager) when it is docked or undocked.
Is there a way to avoid that?
thank you,

Pascal

PS: I must precise this is on a virtual Windows 10 machine running on a MacBook Pro, I don't have the possibility at the moment to test on a regular PC.

Re: Dark skinned application that flashes when started

Posted: Thu Jul 19, 2018 9:06 am
by doublemax
Does it only happen once at the start? What happens if you move a window from another application across your window? Does it look fine or does it flicker?

Re: Dark skinned application that flashes when started

Posted: Thu Jul 19, 2018 9:22 am
by bertolino
It happens just once at the start, and for the panes each time they are docked or undocked.
No flicker at all when covering / uncovering my window with another application.

Re: Dark skinned application that flashes when started

Posted: Thu Jul 19, 2018 10:10 am
by doublemax
I thought you might have forgotten to catch the wxEVT_ERASE_BACKGROUND event or set the background style of the window to wxBG_STYLE_PAINT, but then you should have gotten a flicker on every redraw.

Can you build an executable and upload it somewhere so i can see the effect?

Re: Dark skinned application that flashes when started

Posted: Thu Jul 19, 2018 10:24 am
by bertolino
I already catch wxEVT_ERASE_BACKGROUND. I checked with or without the wxBG_STYLE_PAINT style without any success.
I'm going to extract the necessary piece of code into a minimalist application so that you can see. Thank you!

Re: Dark skinned application that flashes when started

Posted: Thu Jul 19, 2018 3:43 pm
by bertolino
Please find below the address where you can download the exe.
Actually, this is the installer of the application, since it was simpler than extracting the minimalist code.
Please, tell me when I can remove it (it's a working version that should not be available yet).
*link removed*

Many thanks for your time!

Re: Dark skinned application that flashes when started

Posted: Thu Jul 19, 2018 6:57 pm
by doublemax
sensarea.png
sensarea.png (60.48 KiB) Viewed 1750 times
I captured a video of the screen to see exactly what's going on. The white background is not in all areas, only in the icons and custom sliders. But not in the custom radio buttons. You should check if there is a difference in their drawing code.

Re: Dark skinned application that flashes when started

Posted: Thu Jul 19, 2018 7:39 pm
by bertolino
Doublemax, you have done the right test! Great! With this, what happens is quite clear.
To me, the middle figure shows an EVT_ERASE_BACKGROUND event
that either erases with the right colour (dark) or the unwanted color (white).
As you suggest, I'm going to check what are the differences in those classes.
I really thank you for the time you spent to help me, and for your efficacy.

Best regards,
Pascal

PS: Thanks for removing the download link!

Re: Dark skinned application that flashes when started

Posted: Thu Jul 19, 2018 7:45 pm
by doublemax
BTW: The installer fails with an error message when not started as administrator.

Re: Dark skinned application that flashes when started

Posted: Thu Jul 19, 2018 8:29 pm
by bertolino
I have investigated and remarked that the flicker didn't happen
in the class where the EVT_ERASE_BACKGROUND event was not bound.
I also remarked that all my OnPaint methods started with the right dc.Clear()
that ensures to erase with the right color.
So I removed the EVT_ERASE_BACKGROUND binds and there is
no anymore flicker. Actually, the dc.Clear() erases the background but with
the right background color, which is visually acceptable.
I just wonder if what I do is the right solution :-(
Anyway, it's far better like this, thanks again!

PS:
Thanks for your remark about the installer.

Re: Dark skinned application that flashes when started

Posted: Thu Jul 19, 2018 8:50 pm
by doublemax
Was your EVT_ERASE_BACKGROUND event handler completely empty (that's how it should be) ?

Anyway, with the current wxWidgets version it's best to call SetBackgroundStyle( wxBG_STYLE_PAINT ) in the constructor, then the background will not be erased and no EVT_ERASE_BACKGROUND event will be generated.

Do you use double buffering (wx[Auto]BufferedPaintDC) in the paint event handlers? There is still some noticeable (but different kind of) flicker when resizing the main frame.

Re: Dark skinned application that flashes when started

Posted: Fri Jul 20, 2018 9:42 am
by bertolino
Was your EVT_ERASE_BACKGROUND event handler completely empty (that's how it should be) ?
Yes
Do you use double buffering (wx[Auto]BufferedPaintDC) in the paint event handlers? There is still some noticeable (but different kind of) flicker when resizing the main frame.
Not yet, but I will check it, thanks for your help!

Re: Dark skinned application that flashes when started

Posted: Fri Nov 23, 2018 8:12 am
by shawnee
bertolino wrote:Hi, I am developing a dark "skinned" application with buttons, check boxes, ... each derived form wxPanel or wxWindow. Everything works fine but when the application starts and the main frame is displayed, all the skinned objects flash once (it's very fast) as white rectangles just before been displayed correctly. The same thing happens whith the interior of a pane (of a wxAuiManager) when it is docked or undocked.
Is there a way to avoid that?
thank you,

Pascal

PS: I must precise this is on a virtual Windows 10 machine running on a MacBook Pro, I don't have the possibility at the moment to test on a regular PC.
Wow, your dark skinned controls are so nice.
bertolino, is it possible to opensource?