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