Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/VCL/Styles    [ Add a report in this area ]  
Report #:  106783   Status: Closed
When painting TDateTimePicker, VCL styles in XE2 does not handle Windows Classic Theme properly.
Project:  Delphi Build #:  16.0.4429.46931
Version:    16.4 Submitted By:   Warren Postma
Report Type:  Basic functionality failure Date Reported:  6/29/2012 8:02:36 AM
Severity:    Commonly encountered problem Last Updated: 4/15/2014 6:47:31 PM
Platform:    All versions Internal Tracking #:   29545
Resolution: Fixed (Resolution Comments) Resolved in Build: : XE6
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
On Vista, Windows 7 and Windows Server 2008, in the Windows Classic theme, the XE2 Style hooks for TDateTimePicker malfunction.

I guess this is yet another reason why VCL styles are not ready to be really used.
TDateTimePicker control looks fine without VCL styles. Turn on any vcl style, and I get this appearance.

As discussed here:

Please see [Workaround] of QC report for more information.
Steps to Reproduce:
1. Be sure to use a platform that supports Aero glass (such as Vista, Windows 7, or Windows Server 2008 R2), but be sure to turn your theme to Windows Classic first.
2. Create new app in Delphi.
3. Use a TDateTimePicker on a form, turn on VCL Styles in XE2
4. run application.

I can turn off the vcl styles for just this component type, by registering a style hook, but that looks really ugly.
This is on Delphi XE2 with update 4 installed.
Ideally, I hope there is a workaround, or some properties of the datetime picker, or some subclass of datetimepicker I could do to force the datetime picker to paint and theme correctly.
Note that normal comboboxes are theming correctly. Note that this reproduces easily in the most minimal sample project imaginable. Yes. It's Yet Another Styles bug.

It might be platform specific, related to Windows Common Controls versions on Windows Server 2008 R2 without Aero ("Desktop Experience" in Windows server component terms). It just occurred to me after other people cannot reproduce it, to try this on several different Windows machines. After I did that, I find that the problem only reproduces on Windows Server 2008 R2. Some of our customers use Windows Server 2008 R2. As you know a major reason for using VCL Styles is that it makes your app look the same regardless of what the windows theme is. However in the case above, the whole app themes properly, except the DateTimePicker control, which is themed incorrectly, and only on Windows Server 2008 R2. The same XE2-based demo app works fine on Windows 7.

Both the working and non-working systems have a ComCtl32.dll in the SysWow64 folder with version reading 5.82.7601.17514. However, clearly the native layout and appearance of these controls is different, when VCL themes are off, and this affects the skinning code, which fails.
RRUZ's vcl-styles project (open source) has a fix for this.

I just made a small change to the Vcl.Styles.DateTimePickers unit which is part of the vcl-styles-utils. To fix this issue when the "Windows Classic" theme is active.
Use this style hook in this way

TStyleManager.Engine.RegisterStyleHook(TDateTimePicker, TDateTimePickerStyleHookFix);

Tomohiro Takahashi at 6/30/2012 7:34:55 PM -
Is your issue same as(similar to) QC#99628?

  I updated [Description], [Steps], [Workaround] of this report, according to the stackoverflow's thread.

Tomohiro Takahashi at 7/3/2012 7:11:07 AM -
This report was opened with valid Internal Tracking Number.

Server Response from: ETNACODE01