1

I'm experiencing a very weird problem with VCL styles. Sometimes, when either starting the program with a predefined style, or setting one later on, one or some of the program windows dissapear.

This happens very randomly, maybe once every 10-20 times, and not in any specific window. I have 2 forms open at runtime, sometimes it's one, sometimes the other.

When this happens, I check some properties while the window is not visible, the Visible property is true, the window boundaries are correct; if I try to show the window through Aero DWM live thumbnails.. it's also empty; if I capture the window DC however, I get a bitmap with the window as if it was showing normally (and the style has been applied).

It doesn't show any errors, no warnings, no exceptions.. nothing seems wrong, just the window isn't there. If I hover the mouse over the taskbar button to see a preview, it shows the box, but it's empty.

Any ideas what to check?

Edit: calling RecreateWnd fixes the issue as a temporal workaround, however, it might fail again.

7
  • Wild guess, it needs a RecreatWnd. What happens if you click in the preview shown from the taskbar? Commented Apr 4, 2012 at 18:22
  • Nothing. The program becomes active, but nothing is displayed. If I switch to another style (through a tray icon menu) it shows up again. See here, 2 different cases with each of the forms not being displayed through the taskbar preview: i.imgur.com/WT7KK.png i.imgur.com/gjClr.png Also if I do a bitblt on the DC, it captures the window with the style applied properly. Commented Apr 4, 2012 at 22:04
  • Calling RecreateWnd fixes the issue, I'll just call this on startup and after changing the style as a temporal workaround. Commented Apr 5, 2012 at 0:33
  • Another observation: calling RecreateWnd when the form is actually display properly, can sometimes end up with the same glitch: the window poofs; so it doesn't work as a work-around either (unless I had a way to detect when the glitch occurs). Commented Apr 5, 2012 at 0:42
  • Can you provide a basic code to replicate the issue? Commented Apr 5, 2012 at 1:09

1 Answer 1

2

Found the cause of the issue: "Alphablend". If this is enabled, even at 255, the issue occurs.

Steps to reproduce:

  • Open new VCL forms project
  • Project options, appearance, set a style theme. I used Cobalt XE for the test
  • Set Alphablend to true
  • Run

It may take 10-20 runs till it glitches.

I noticed when it happens, the window is actually there.. you can hover the mouse over and notice there is something there. You can even click on controls if you guess their location. If you manage to drag the window while it's not visible, it will show up. If you minimize/restore it will show up as well.

If you do alt+PrtScr while the window is active, and paste in Paint etc, you will get the contents behind it with the window boundaries, as if alphablendvalue was set to 0.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.