I'm using edDateEdit in a stringgrid to pick dates.
The grid is programatically filled from data in a database. If the DB date field is NULL, the grid cell is filled with empty quotes.
I can't the datetimepicker in the grid to set the selected date, unless I press enter after picking the date. (Only when the field was originally empty.) Upon saving the grid back to the database, the selected date is not entered, only the current date - which I know is what I'm artificially setting to prevent the datetime picker from erroring on editing.
in the geteditortype for the grid in question, I'm handling the empty cell as follows:
procedure TfrmBooze.grdBoozeGetEditorType(Sender: TObject; ACol, ARow: Integer;
var AEditor: TEditorType);
var
i : integer;
begin
with grdBooze do
if ACol in [7] then
begin
if grdBooze.Cells[grdBooze.Selection.Right, grdBooze.Selection.Top] = ' ' then
begin
grdBooze.Cells[grdBooze.Selection.Right, grdBooze.Selection.Top] := datetostr(tdatetime(date));
exit;
end;
AEditor := edDateEdit;
datetimepicker.date := grdBooze.DateTimePicker.Date;
end;
end;