Dark skinned application that flashes when started

Are you writing your own components and need help with how to set them up or have questions about the components you are deriving from ? Ask them here.
Post Reply
bertolino
Experienced Solver
Experienced Solver
Posts: 77
Joined: Wed Aug 14, 2013 8:07 am
Location: France
Contact:

Dark skinned application that flashes when started

Post 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.
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Dark skinned application that flashes when started

Post 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?
Use the source, Luke!
bertolino
Experienced Solver
Experienced Solver
Posts: 77
Joined: Wed Aug 14, 2013 8:07 am
Location: France
Contact:

Re: Dark skinned application that flashes when started

Post 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.
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Dark skinned application that flashes when started

Post 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?
Use the source, Luke!
bertolino
Experienced Solver
Experienced Solver
Posts: 77
Joined: Wed Aug 14, 2013 8:07 am
Location: France
Contact:

Re: Dark skinned application that flashes when started

Post 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!
bertolino
Experienced Solver
Experienced Solver
Posts: 77
Joined: Wed Aug 14, 2013 8:07 am
Location: France
Contact:

Re: Dark skinned application that flashes when started

Post 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!
Last edited by doublemax on Thu Jul 19, 2018 6:16 pm, edited 1 time in total.
Reason: removed download link
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Dark skinned application that flashes when started

Post by doublemax »

sensarea.png
sensarea.png (60.48 KiB) Viewed 17951 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.
Use the source, Luke!
bertolino
Experienced Solver
Experienced Solver
Posts: 77
Joined: Wed Aug 14, 2013 8:07 am
Location: France
Contact:

Re: Dark skinned application that flashes when started

Post 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!
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Dark skinned application that flashes when started

Post by doublemax »

BTW: The installer fails with an error message when not started as administrator.
Use the source, Luke!
bertolino
Experienced Solver
Experienced Solver
Posts: 77
Joined: Wed Aug 14, 2013 8:07 am
Location: France
Contact:

Re: Dark skinned application that flashes when started

Post 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.
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Dark skinned application that flashes when started

Post 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.
Use the source, Luke!
bertolino
Experienced Solver
Experienced Solver
Posts: 77
Joined: Wed Aug 14, 2013 8:07 am
Location: France
Contact:

Re: Dark skinned application that flashes when started

Post 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!
shawnee
Experienced Solver
Experienced Solver
Posts: 78
Joined: Tue Jan 16, 2018 1:05 am

Re: Dark skinned application that flashes when started

Post 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?
bertolino
Experienced Solver
Experienced Solver
Posts: 77
Joined: Wed Aug 14, 2013 8:07 am
Location: France
Contact:

Re: Dark skinned application that flashes when started

Post by bertolino »

Hi Shawnee,
Thanks for your kind words and sorry for my very late response.
Unfortunately, I cannot opensource the corresponding piece of code since it is used in a future commercial application.

Pascal
Post Reply