You've already forked lazarus-ccr
Fix: Date/Time, restore old value.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2059 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -286,7 +286,6 @@ end;
|
|||||||
|
|
||||||
procedure TJDbGridDateTimeCtrl.myEditOnEditingDone(Sender: TObject);
|
procedure TJDbGridDateTimeCtrl.myEditOnEditingDone(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
CellEditor.Caption := NormalizeDateTime(CellEditor.Caption, theValue);
|
|
||||||
if Length(CellEditor.Caption) = 0 then
|
if Length(CellEditor.Caption) = 0 then
|
||||||
begin
|
begin
|
||||||
if edited then
|
if edited then
|
||||||
@ -300,21 +299,25 @@ begin
|
|||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if IsValidDateTimeString(CellEditor.Caption) then
|
|
||||||
begin
|
begin
|
||||||
if edited and (not updated) then
|
CellEditor.Caption := NormalizeDateTime(CellEditor.Caption, theValue);
|
||||||
|
if IsValidDateTimeString(CellEditor.Caption) then
|
||||||
begin
|
begin
|
||||||
Field.DataSet.DisableControls;
|
if edited and (not updated) then
|
||||||
theValue := StrToDateTime(CellEditor.Caption);
|
begin
|
||||||
Field.DataSet.Edit;
|
Field.DataSet.DisableControls;
|
||||||
Field.AsDateTime := theValue;
|
theValue := StrToDateTime(CellEditor.Caption);
|
||||||
Field.DataSet.EnableControls;
|
Field.DataSet.Edit;
|
||||||
|
Field.AsDateTime := theValue;
|
||||||
|
Field.DataSet.EnableControls;
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
ShowMessage(Format(SInvalidDateTime, [CellEditor.Caption]));
|
||||||
|
CellEditor.Text := FormatDateTime(DisplayFormat, Field.AsDateTime);
|
||||||
end;
|
end;
|
||||||
end
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
ShowMessage(Format(SInvalidDateTime, [CellEditor.Caption]));
|
|
||||||
CellEditor.Text := FormatDateTime(DisplayFormat, theValue);
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -446,7 +449,6 @@ end;
|
|||||||
|
|
||||||
procedure TJDbGridTimeCtrl.myEditOnEditingDone(Sender: TObject);
|
procedure TJDbGridTimeCtrl.myEditOnEditingDone(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
CellEditor.Caption := NormalizeTime(CellEditor.Caption, theValue);
|
|
||||||
if Length(CellEditor.Caption) = 0 then
|
if Length(CellEditor.Caption) = 0 then
|
||||||
begin
|
begin
|
||||||
if edited then
|
if edited then
|
||||||
@ -460,21 +462,24 @@ begin
|
|||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if IsValidTimeString(CellEditor.Caption) then
|
|
||||||
begin
|
begin
|
||||||
if edited and (not updated) then
|
CellEditor.Caption := NormalizeTime(CellEditor.Caption, theValue);
|
||||||
|
if IsValidTimeString(CellEditor.Caption) then
|
||||||
begin
|
begin
|
||||||
Field.DataSet.DisableControls;
|
if edited and (not updated) then
|
||||||
theValue := StrToTime(CellEditor.Caption);
|
begin
|
||||||
Field.DataSet.Edit;
|
Field.DataSet.DisableControls;
|
||||||
Field.AsDateTime := theValue;
|
theValue := StrToTime(CellEditor.Caption);
|
||||||
Field.DataSet.EnableControls;
|
Field.DataSet.Edit;
|
||||||
|
Field.AsDateTime := theValue;
|
||||||
|
Field.DataSet.EnableControls;
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
ShowMessage(Format(SInvalidTime, [CellEditor.Caption]));
|
||||||
|
CellEditor.Text := FormatDateTime(DisplayFormat, Field.AsDateTime);
|
||||||
end;
|
end;
|
||||||
end
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
ShowMessage(Format(SInvalidTime, [CellEditor.Caption]));
|
|
||||||
CellEditor.Text := FormatDateTime(DisplayFormat, theValue);
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -605,7 +610,6 @@ end;
|
|||||||
|
|
||||||
procedure TJDbGridDateCtrl.myEditOnEditingDone(Sender: TObject);
|
procedure TJDbGridDateCtrl.myEditOnEditingDone(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
CellEditor.Caption := NormalizeDate(CellEditor.Caption, theValue);
|
|
||||||
if Length(CellEditor.Caption) = 0 then
|
if Length(CellEditor.Caption) = 0 then
|
||||||
begin
|
begin
|
||||||
if edited then
|
if edited then
|
||||||
@ -619,21 +623,24 @@ begin
|
|||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if IsValidDateString(CellEditor.Caption) then
|
|
||||||
begin
|
begin
|
||||||
if edited and (not updated) then
|
CellEditor.Caption := NormalizeDate(CellEditor.Caption, theValue);
|
||||||
|
if IsValidDateString(CellEditor.Caption) then
|
||||||
begin
|
begin
|
||||||
Field.DataSet.DisableControls;
|
if edited and (not updated) then
|
||||||
theValue := StrToDate(CellEditor.Caption);
|
begin
|
||||||
Field.DataSet.Edit;
|
Field.DataSet.DisableControls;
|
||||||
Field.AsDateTime := theValue;
|
theValue := StrToDate(CellEditor.Caption);
|
||||||
field.DataSet.EnableControls;
|
Field.DataSet.Edit;
|
||||||
|
Field.AsDateTime := theValue;
|
||||||
|
field.DataSet.EnableControls;
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
ShowMessage(Format(SInvalidDate, [CellEditor.Caption]));
|
||||||
|
CellEditor.Text := FormatDateTime(DisplayFormat, Field.AsDateTime);
|
||||||
end;
|
end;
|
||||||
end
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
ShowMessage(Format(SInvalidDate, [CellEditor.Caption]));
|
|
||||||
CellEditor.Text := FormatDateTime(DisplayFormat, theValue);
|
|
||||||
end;
|
end;
|
||||||
//formatInput;
|
//formatInput;
|
||||||
end;
|
end;
|
||||||
|
Reference in New Issue
Block a user