From a669e9886bcbba2b6926017a4cc66a762b012639 Mon Sep 17 00:00:00 2001 From: jujibo Date: Wed, 5 Oct 2011 10:09:04 +0000 Subject: [PATCH] Fix: TJDBGridControl AV in design mode git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2063 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/jujiboutils/src/jdbgridcontrol.pas | 44 ++++++++++--------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/components/jujiboutils/src/jdbgridcontrol.pas b/components/jujiboutils/src/jdbgridcontrol.pas index c7e062bfd..213eeb3d4 100644 --- a/components/jujiboutils/src/jdbgridcontrol.pas +++ b/components/jujiboutils/src/jdbgridcontrol.pas @@ -159,26 +159,30 @@ begin if Result <> nil then begin C := ColumnFromGridColumn(Column); - bs := C.ButtonStyle; - aField := GetFieldFromGridColumn(Column); - if (aField <> nil) and (bs = cbsAuto) then + if C <> nil then begin - case aField.DataType of - ftSmallint, ftInteger: - Result := integerDbGridControl.Editor(Self); - ftDate: - Result := dateDbGridControl.Editor(Self); - ftTime: - Result := timeDbGridControl.Editor(Self); - ftDateTime: - Result := dateTimeDbGridControl.Editor(Self); - ftCurrency, ftFloat: - Result := - doubleDbGridControl.Editor(Self, Columns[Column - 1].Decimals); - ftBCD: - Result := doubleDbGridControl.Editor(Self, aField.Size); - ftString: - Result := stringDbGridControl.Editor(Self, Columns[Column - 1].MaxLength); + bs := C.ButtonStyle; + aField := GetFieldFromGridColumn(Column); + if (aField <> nil) and (bs = cbsAuto) then + begin + writeln(aField.DataType); + case aField.DataType of + ftSmallint, ftInteger: + Result := integerDbGridControl.Editor(Self); + ftDate: + Result := dateDbGridControl.Editor(Self); + ftTime: + Result := timeDbGridControl.Editor(Self); + ftDateTime: + Result := dateTimeDbGridControl.Editor(Self); + ftCurrency, ftFloat: + Result := + doubleDbGridControl.Editor(Self, Columns[Column - 1].Decimals); + ftBCD: + Result := doubleDbGridControl.Editor(Self, aField.Size); + ftString: + Result := stringDbGridControl.Editor(Self, Columns[Column - 1].MaxLength); + end; end; end; end; @@ -186,7 +190,7 @@ end; procedure TJDBGridControl.UpdateData; begin - if not(Editor is TJStringCellEditor) then + if not (Editor is TJStringCellEditor) then inherited UpdateData; end;