Fix: TJDBGridControl AV in design mode

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2063 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
jujibo
2011-10-05 10:09:04 +00:00
parent 2565275b1b
commit a669e9886b

View File

@@ -159,26 +159,30 @@ begin
if Result <> nil then if Result <> nil then
begin begin
C := ColumnFromGridColumn(Column); C := ColumnFromGridColumn(Column);
bs := C.ButtonStyle; if C <> nil then
aField := GetFieldFromGridColumn(Column);
if (aField <> nil) and (bs = cbsAuto) then
begin begin
case aField.DataType of bs := C.ButtonStyle;
ftSmallint, ftInteger: aField := GetFieldFromGridColumn(Column);
Result := integerDbGridControl.Editor(Self); if (aField <> nil) and (bs = cbsAuto) then
ftDate: begin
Result := dateDbGridControl.Editor(Self); writeln(aField.DataType);
ftTime: case aField.DataType of
Result := timeDbGridControl.Editor(Self); ftSmallint, ftInteger:
ftDateTime: Result := integerDbGridControl.Editor(Self);
Result := dateTimeDbGridControl.Editor(Self); ftDate:
ftCurrency, ftFloat: Result := dateDbGridControl.Editor(Self);
Result := ftTime:
doubleDbGridControl.Editor(Self, Columns[Column - 1].Decimals); Result := timeDbGridControl.Editor(Self);
ftBCD: ftDateTime:
Result := doubleDbGridControl.Editor(Self, aField.Size); Result := dateTimeDbGridControl.Editor(Self);
ftString: ftCurrency, ftFloat:
Result := stringDbGridControl.Editor(Self, Columns[Column - 1].MaxLength); 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; end;
end; end;
@@ -186,7 +190,7 @@ end;
procedure TJDBGridControl.UpdateData; procedure TJDBGridControl.UpdateData;
begin begin
if not(Editor is TJStringCellEditor) then if not (Editor is TJStringCellEditor) then
inherited UpdateData; inherited UpdateData;
end; end;