From b620ebf276fa83d2bcd83e178a2362a0933f12bf Mon Sep 17 00:00:00 2001 From: jujibo Date: Tue, 27 Sep 2011 16:17:54 +0000 Subject: [PATCH] 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 --- .../jujibo-utils/src/jdbgridutils.pas | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/components/jujiboutils/jujibo-utils/src/jdbgridutils.pas b/components/jujiboutils/jujibo-utils/src/jdbgridutils.pas index c695c37ad..872e47c00 100644 --- a/components/jujiboutils/jujibo-utils/src/jdbgridutils.pas +++ b/components/jujiboutils/jujibo-utils/src/jdbgridutils.pas @@ -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