I'm using Lazarus 1.8.4 on a Win7/32 system.
COMMENT:
Most Comboboxes will display the dropdown list when the Alt+Down key combination is pressed.
This key combination does not work with the DateTimePicker. -- OR am I missing somethting?)
Creating a DateTimePicker descendant that overrides the KeyDown method does not work because the descendant needs to call the method/procedure DropDownCalendarForm and this method is not visible to the descendant.
THE SUGGESTION:
In the TDateTimePicker class (which is located in the datetimepicker.pas file) move the DropDownCalendarForm procedure from the "Private" section to the "Protected" section or the "Public" section.
Doing this will make it possible to create a descendant that implements the Alt+Down functionality.
A partial example of such a descendant is given in the following code:
unit mtrsDTPicker;
{ NOTE:
This unit depends on the procedure "DropDownCalendarForm" in DateTimePicker.pas
being moved from the "Private" to the "Protected" section of the source code
in the TCustomDateTimePicker class.
This change in "visiblity" is required so that this descendant can call the
DropDownCalendarForm procedure.
}
{$mode objfpc}{$H+}
interface
uses
Classes
//, SysUtils
, DateTimePicker
;
Type
TmtrDTPicker = Class(TDateTimePicker)
protected
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
end;
implementation
Uses
Windows {This is required so that the VK_DOWN constant is recognized.}
;
procedure TmtrDTPicker.KeyDown(var Key: Word; Shift: TShiftState);
begin
If (Key = VK_DOWN) and (Shift = [ssAlt]) then
begin
Key := 0;
Shift := [];
If NOT DroppedDown then DropDownCalendarForm;
exit;
end;
Inherited;
end;
end.
I have not checked the TdbDateTimePicker class, but assume that the above suggested change will automatically propigate to it.
Regards,
John