Fix: disable controls while editing in grid and resync (Zeos7)

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2024 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
jujibo 2011-09-27 16:17:54 +00:00
parent 1e1626ad16
commit b620ebf276

View File

@ -177,19 +177,23 @@ begin
CellEditor.Caption := NormalizeDateTime(CellEditor.Caption, theValue);
if Length(CellEditor.Caption) = 0 then
begin
Field.DataSet.DisableControls;
Field.DataSet.Edit;
Field.Value := Null;
theValue := 0;
updated := True;
Field.DataSet.EnableControls;
end
else
if IsValidDateTimeString(CellEditor.Caption) then
begin
if (not updated) then
begin
Field.DataSet.DisableControls;
theValue := StrToDateTime(CellEditor.Caption);
Field.DataSet.Edit;
Field.AsDateTime := theValue;
Field.DataSet.EnableControls;
end;
end
else
@ -314,19 +318,23 @@ begin
CellEditor.Caption := NormalizeTime(CellEditor.Caption, theValue);
if Length(CellEditor.Caption) = 0 then
begin
Field.DataSet.DisableControls;
Field.DataSet.Edit;
Field.Value := Null;
theValue := 0;
updated := True;
Field.DataSet.EnableControls;
end
else
if IsValidTimeString(CellEditor.Caption) then
begin
if (not updated) then
begin
Field.DataSet.DisableControls;
theValue := StrToTime(CellEditor.Caption);
Field.DataSet.Edit;
Field.AsDateTime := theValue;
Field.DataSet.EnableControls;
end;
end
else
@ -458,19 +466,23 @@ begin
CellEditor.Caption := NormalizeDate(CellEditor.Caption, theValue);
if Length(CellEditor.Caption) = 0 then
begin
Field.DataSet.DisableControls;
Field.DataSet.Edit;
Field.Value := Null;
theValue := 0;
updated := True;
Field.DataSet.EnableControls;
end
else
if IsValidDateString(CellEditor.Caption) then
begin
if (not updated) then
begin
Field.DataSet.DisableControls;
theValue := StrToDate(CellEditor.Caption);
Field.DataSet.Edit;
Field.AsDateTime := theValue;
field.DataSet.EnableControls;
end;
end
else
@ -599,11 +611,11 @@ begin
if (not updated) then
begin
theValue := StrToFloat(CellEditor.Caption);
Field.DataSet.DisableControls;
Field.DataSet.Edit;
//theValue := redondear(theValue, fDecimales);
Field.AsFloat := theValue;
// normalize value
Field.Value := textNumber(Field.DisplayText);
Field.DataSet.EnableControls;
end;
end
else
@ -794,9 +806,11 @@ begin
begin
if (not updated) then
begin
Field.DataSet.DisableControls;
theValue := StrToInt(CellEditor.Caption);
Field.DataSet.Edit;
Field.AsInteger := theValue;
field.DataSet.EnableControls;
end;
end
else