Transparency issues with #10Seattle ?

Transparency issues with #10Seattle ?

Update: Enabling Runtime Themes in Project Options, solves this issue.

I'm having some transparency weirdness issues which I find difficult to recreate in a SSCE.  In the attached image, you can see a login dialog in design mode at upper left, and some of it's properties at the right - and in the middle - the running dialog.  You see those three white spaces that is not in design mode?  That's TLabels that fail to be transparent.

In the .dfm, the highlighted label looks like:

  object lAppDetail: TLabel
    Left = 33
    Top = 82
    Width = 54
    Height = 14
    Caption = 'lAppDetail'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clInfoBk
    Font.Height = -12
    Font.Name = 'Tahoma'
    Font.Style = []
    ParentFont = False
  end

The labels are transparent when compiled with XE7.

Here comes the weird part: To make the label transparent again, I just uncheck and recheck the transparent property, which adds the transparent property.

  object lAppDetail: TLabel
    Left = 33
    Top = 82
    Width = 54
    Height = 14
    Caption = 'lAppDetail'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clInfoBk
    Font.Height = -12
    Font.Name = 'Tahoma'
    Font.Style = []
    ParentFont = False
    Transparent = True
  end

So - I try to recreate in an SCCE - I create a new form in XE7, add an image, add a label, set the same colors, etc. It's transparent when running in XE7.  I open the project in 10Seattle - and it is transparent when running there too! And there is no Transparent = True property in the .dfm.

Weird or what?



Comments

  1. TLabel has some "weird" way of setting initial transparent value and whether or not it will be stored in dfm. Some of that code must have been changed in Seattle. 

    Look at following code for changes: 

    TCustomLabel property declaration:

        property Transparent: Boolean read GetTransparent write SetTransparent stored FTransparentSet;

    TCustomLabel.Create 
    TCustomLabel.SetTransparent

    I don't have Seattle so I cannot look myself.

    ReplyDelete
  2. Ok, I think I can see something here. From the project screenshots it seems that you don't have themes enabled. Since that is trigger that determines initial label transparency I would say this is what causes weird behavior.

    New project you have created probably has them turned on by default.

    From TCustomLabel.Create

      { The "default" value for the Transparent property depends on
        if you have Themes available and enabled or not. If you have
        ever explicitly set it, that will override the default value. }
      if StyleServices.Enabled then
        ControlStyle := ControlStyle - [csOpaque]
      else
        ControlStyle := ControlStyle + [csOpaque];

    ReplyDelete
  3. Looking at the source code of XE7, assigning anything to the TCustomLabel.Transparent property setter always makes sure that it will be stored. If that property's value is never changed, then it will no longer be stored:

        property Transparent: Boolean read GetTransparent write SetTransparent stored FTransparentSet;

    procedure TCustomLabel.SetTransparent(Value: Boolean);
    begin
      // ... (change property value and invalidate)
      FTransparentSet := True;
    end;

    That's the only two places where FTransparentSet is used in the entire C:\Program Files (x86)\Embarcadero\Studio\15.0\source branch...

    No idea what the reasoning behind this was.
    I haven’t installed Seattle yet, so can’t check.

    ReplyDelete
  4. Yup, lack of themes seems to be the obvious culprit.

    ReplyDelete
  5. I can confirm that the code for TCustomLabel has not been changed in D10Seattle, compared to XE7.

    ReplyDelete
  6. Confirmed! Thanks, people!   Project, Options, Application, Manifestfile (Autogenerate), and checking Enable Runtime Themes - solves the problem.

    But - in XE7 it does say: Runtime Themes: Enable runtime themes, and the style is Windows.  

    Why doesn't this make it through the .dproj upgrade? The checkbox was NOT set in #10Seattle .

    ReplyDelete
  7. Lars Fosdal Settle introduced changes in manifest options. Before you could only enable/disable themes and now you can also customize High DPI and Administrator options. Inevitably, backing dproj fields have changed and no proper upgrade was provided.

    Which reminds me of recent discussion we had here about Delphi project options. This is just another example how badly broken it is.

    https://plus.google.com/u/0/+BrandonStaggs1611/posts/WjL9RHkXapA

    ReplyDelete
  8. Interestingly, the theme setting has been correctly propagated in all the other VCL UI apps. Chalk one up for the ghost in the machine.

    ReplyDelete

Post a Comment