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