Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8682083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:40:33+00:00 2026-06-12T21:40:33+00:00

I have an application, built in Delphi 2007, with a TDateTimePicker on the form.

  • 0

I have an application, built in Delphi 2007, with a TDateTimePicker on the form. This date time picker has the ShowCheckbox property set to True, which next to date or time displays a check box, that is automatically selected whenever a date is picked by user, or when the date or time is changed by code. The state of this check box can also be manually controlled by the user and its state can be determined by the Checked property.

The following code shows how to determine the state of this check box in the OnChange event:

procedure TForm1.FormCreate(Sender: TObject);
begin
  DateTimePicker1.ShowCheckbox := True;
end;

procedure TForm1.DateTimePicker1Change(Sender: TObject);
begin
  ShowMessage('Checked: ' + BoolToStr(DateTimePicker1.Checked, True));
end;

The above code works as expected on Windows XP, but on Windows 7, the Checked property returns always True regardless of the real state of that check box.

Why does Checked property return always True, even when the check box is unchecked ? Is there a way to fix or workaround this somehow ?

P.S. My application uses Windows themes

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T21:40:35+00:00Added an answer on June 12, 2026 at 9:40 pm

    This is a known issue in Delphi date time picker control’s implementation (fixed in Delphi 2009, as @Remy pointed in his comment). To query the state of a date time picker check box should be used either DTM_GETSYSTEMTIME message, or the DateTime_GetSystemtime macro, which internally sends this message. If the message (or the macro) returns GDT_VALID value, and the DTS_SHOWNONE style is used (in Delphi when ShowCheckbox property is True), it indicates that the control’s check box is checked and that control contains a valid date time.

    Here’s the example of how to use the mentioned macro to determine the check box state:

    uses
      CommCtrl;
    
    procedure TForm1.DateTimePicker1Change(Sender: TObject);
    var
      SysTime: SYSTEMTIME;
    begin
      if DateTime_GetSystemTime(DateTimePicker1.Handle, @SysTime) = GDT_VALID then
        ShowMessage('Check box is checked!')
      else
        ShowMessage('Check box is not checked!');
    end;
    

    So, you can make a helper function like this to workaround the wrong Delphi implementation:

    uses
      CommCtrl;
    
    function IsDateTimePickerChecked(ADateTimePicker: TDateTimePicker): Boolean;
    var
      SysTime: SYSTEMTIME;
    begin
      Result := DateTime_GetSystemTime(ADateTimePicker.Handle, @SysTime) = GDT_VALID;
    end;
    
    procedure TMyForm.ButtonOneClick(Sender: TObject);
    begin
      if IsDateTimePickerChecked(DateTimePicker1) then
        ShowMessage('Check box is checked!')
      else
        ShowMessage('Check box is not checked!');
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application built using JSF1.2. I have a home page which has
I am really stumped. I am running delphi 2007 on vista. I have built
I have an application built in Delphi and it accesses MySQL database using MyDAC
Has anyone successfully used the AJAX-enabled ASP.NET Web Application wizard in Delphi 2007 to
I have a DirectShow filter graph in my Delphi 6 application built with the
I have a service application built in Delphi that works great. It does exactly
We have a Delphi 5 application, that is built without runtime packages, dlls or
I have an application built for iPhone 2.0 but I would like to use
I have an application built for 1.5 and I am adding higher resolution drawables
I already have an application built in asp.net 3.5 and now I want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.