Fix: save time value properly

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2454 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
jujibo 2012-06-08 16:11:43 +00:00
parent 687d0023d0
commit cf72334b8a
3 changed files with 51 additions and 50 deletions

View File

@ -5,6 +5,7 @@ Note: Lazarus Trunk required
Version pre-1.1 Version pre-1.1
-------------------------------------------------- --------------------------------------------------
2012-06-12 Fixed: TJDbGridTimeCtrl, store time value
2012-03-14 Fixed: Prevent double updates (QT widgetset) in edit widgets 2012-03-14 Fixed: Prevent double updates (QT widgetset) in edit widgets
2012-03-06 Fixed: Focus issues 2012-03-06 Fixed: Focus issues

View File

@ -194,7 +194,7 @@ begin
begin begin
aTime := StrToTime(texto); aTime := StrToTime(texto);
Result := TimeString;// FormatDateTime(aTimeFormat, aTime); Result := TimeString;// FormatDateTime(aTimeFormat, aTime);
end; end
end; end;
tokens.Free; tokens.Free;
//ShowMessage('Hora normalizada: ' + Result); //ShowMessage('Hora normalizada: ' + Result);

View File

@ -497,7 +497,7 @@ begin
begin begin
Field.DataSet.DisableControls; Field.DataSet.DisableControls;
Field.DataSet.Edit; Field.DataSet.Edit;
Field.AsDateTime := theValue; Field.Text := NormalizeTime(CellEditor.Caption, Field.AsDateTime);
Field.DataSet.EnableControls; Field.DataSet.EnableControls;
end; end;
end; end;
@ -545,6 +545,7 @@ begin
end; end;
end end
else else
if Length(CellEditor.Caption) <> 0 then
if (Key in [VK_RETURN, VK_TAB, VK_UP, VK_DOWN, VK_LEFT, VK_RIGHT]) and if (Key in [VK_RETURN, VK_TAB, VK_UP, VK_DOWN, VK_LEFT, VK_RIGHT]) and
(not IsValidTimeString(NormalizeTime(CellEditor.Caption, theValue))) then (not IsValidTimeString(NormalizeTime(CellEditor.Caption, theValue))) then
begin begin
@ -582,7 +583,7 @@ begin
begin begin
theValue := StrToTime(CellEditor.Caption); theValue := StrToTime(CellEditor.Caption);
Field.DataSet.Edit; Field.DataSet.Edit;
Field.AsDateTime := theValue; Field.Text := NormalizeTime(CellEditor.Caption, Field.AsDateTime);
CellEditor.SelectAll; CellEditor.SelectAll;
updated := True; updated := True;
end; end;
@ -916,7 +917,7 @@ begin
Field.DataSet.Edit; Field.DataSet.Edit;
if decimals > 0 then if decimals > 0 then
theValue := ScaleTo(theValue, fDecimals); theValue := ScaleTo(theValue, fDecimals);
Field.Value := theValue; ; Field.Value := theValue;
CellEditor.Text := Field.AsString; CellEditor.Text := Field.AsString;
updated := True; updated := True;
end; end;
@ -1095,4 +1096,3 @@ begin
end; end;
end. end.