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:
jujibo
2011-10-03 08:23:50 +00:00
parent 9391552baa
commit 4080716092

View File

@ -286,7 +286,6 @@ end;
procedure TJDbGridDateTimeCtrl.myEditOnEditingDone(Sender: TObject);
begin
CellEditor.Caption := NormalizeDateTime(CellEditor.Caption, theValue);
if Length(CellEditor.Caption) = 0 then
begin
if edited then
@ -300,6 +299,8 @@ begin
end;
end
else
begin
CellEditor.Caption := NormalizeDateTime(CellEditor.Caption, theValue);
if IsValidDateTimeString(CellEditor.Caption) then
begin
if edited and (not updated) then
@ -314,7 +315,9 @@ begin
else
begin
ShowMessage(Format(SInvalidDateTime, [CellEditor.Caption]));
CellEditor.Text := FormatDateTime(DisplayFormat, theValue);
CellEditor.Text := FormatDateTime(DisplayFormat, Field.AsDateTime);
end;
end;
end;
@ -446,7 +449,6 @@ end;
procedure TJDbGridTimeCtrl.myEditOnEditingDone(Sender: TObject);
begin
CellEditor.Caption := NormalizeTime(CellEditor.Caption, theValue);
if Length(CellEditor.Caption) = 0 then
begin
if edited then
@ -460,6 +462,8 @@ begin
end;
end
else
begin
CellEditor.Caption := NormalizeTime(CellEditor.Caption, theValue);
if IsValidTimeString(CellEditor.Caption) then
begin
if edited and (not updated) then
@ -474,7 +478,8 @@ begin
else
begin
ShowMessage(Format(SInvalidTime, [CellEditor.Caption]));
CellEditor.Text := FormatDateTime(DisplayFormat, theValue);
CellEditor.Text := FormatDateTime(DisplayFormat, Field.AsDateTime);
end;
end;
end;
@ -605,7 +610,6 @@ end;
procedure TJDbGridDateCtrl.myEditOnEditingDone(Sender: TObject);
begin
CellEditor.Caption := NormalizeDate(CellEditor.Caption, theValue);
if Length(CellEditor.Caption) = 0 then
begin
if edited then
@ -619,6 +623,8 @@ begin
end;
end
else
begin
CellEditor.Caption := NormalizeDate(CellEditor.Caption, theValue);
if IsValidDateString(CellEditor.Caption) then
begin
if edited and (not updated) then
@ -633,7 +639,8 @@ begin
else
begin
ShowMessage(Format(SInvalidDate, [CellEditor.Caption]));
CellEditor.Text := FormatDateTime(DisplayFormat, theValue);
CellEditor.Text := FormatDateTime(DisplayFormat, Field.AsDateTime);
end;
end;
//formatInput;
end;