Suggestions for TJvDateTimePicker and TJvDBDateTimePicker For those of us who didn't have anything else to do, I needed some changes to these controls to fix some issues that I was having. These are by no means a final solution, but are submitted to provide some support for others who are more in tune with the official version of this code. In order to add to the capabilities of these controls, the following are submitted as suggestions, but can only be considered a 'work in progress'. //----------------------------------------------------------------- // TJvDBDateTimePicker // fixes 'must be in showcheckbox mode' errors for database usage // notes: // sets default (arbitrary) date/time part for 'other' part DB field // (date or time) to make the working value non-zero // does not fix when DB field value is both 'date AND time', // and happens to be null or equal to the NullDate value // add 'FDKeepDate: TDateTime' in private section of class //----------------------------------------------------------------- procedure TJvDBDateTimePicker.DataChange(Sender: TObject); begin if FDataLink.Field <> nil then begin if Kind = dtkDate then begin if IsDateAndTimeField then DateTime := FDataLink.Field.AsDateTime else // changed line DateTime := Trunc(FDataLink.Field.AsDateTime) + EncodeTime(12, 0, 0, 0); end else begin if IsDateAndTimeField then begin // added/changed lines DateTime := FDataLink.Field.AsDateTime; FKeepDate := Trunc(DateTime); DateTime := Trunc(Now) + Frac(DateTime); end else DateTime := Trunc(Now) + Frac(FDataLink.Field.AsDateTime); end; end else if csDesigning in ComponentState then begin DateTime := Now; end; CheckNullValue; end; //----------------------------------------------------------------- // TJvDBDateTimePicker // fixes non-editing response for first up/down click on control // notes: // added 'CNNotify' to class //----------------------------------------------------------------- procedure TJvDBDateTimePicker.CNNotify(var Msg: TWMNotify); begin with Msg, NMHdr^ do case code of MCN_LAST: begin FDataLink.Edit; end; end; inherited; end; //----------------------------------------------------------------- // TJvDateTimePicker // fixes disabled control when value becomes equal to NullDate during editing // notes: // removes null text for duration of editing // add 'FDKeepNullText: String' in private section of class //----------------------------------------------------------------- procedure TJvDateTimePicker.CNNotify(var Msg: TWMNotify); ... begin with Msg, NMHdr^ do case code of ... // added lines NM_SETFOCUS: begin FKeepNullText := NullText; NullText := ''; inherited; end; NM_KILLFOCUS: begin NullText := FKeepNullText; inherited; end; ... else inherited; end; end;