You've already forked lazarus-ccr
Allow use of ButtonStyle
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2036 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -56,6 +56,7 @@ type
|
|||||||
TJDBGridControl = class(TDBGrid)
|
TJDBGridControl = class(TDBGrid)
|
||||||
private
|
private
|
||||||
{ Private declarations }
|
{ Private declarations }
|
||||||
|
usingControl: Boolean;
|
||||||
dateDbGridControl: TJDbGridDateCtrl;
|
dateDbGridControl: TJDbGridDateCtrl;
|
||||||
timeDbGridControl: TJDbGridTimeCtrl;
|
timeDbGridControl: TJDbGridTimeCtrl;
|
||||||
integerDbGridControl: TJDbGridIntegerCtrl;
|
integerDbGridControl: TJDbGridIntegerCtrl;
|
||||||
@ -65,7 +66,6 @@ type
|
|||||||
procedure SetColumns(AValue: TJDBGridColumns);
|
procedure SetColumns(AValue: TJDBGridColumns);
|
||||||
protected
|
protected
|
||||||
{ Protected declarations }
|
{ Protected declarations }
|
||||||
//procedure SelectEditor; override;
|
|
||||||
function CreateColumns: TGridColumns; override;
|
function CreateColumns: TGridColumns; override;
|
||||||
function GetDefaultEditor(Column: integer): TWinControl; override;
|
function GetDefaultEditor(Column: integer): TWinControl; override;
|
||||||
procedure UpdateData; override;
|
procedure UpdateData; override;
|
||||||
@ -119,20 +119,6 @@ end;
|
|||||||
|
|
||||||
{ TJDBGridControl }
|
{ TJDBGridControl }
|
||||||
|
|
||||||
//procedure TJDBGridControl.SelectEditor;
|
|
||||||
//begin
|
|
||||||
// inherited SelectEditor;
|
|
||||||
// if Editor <> nil then
|
|
||||||
// begin
|
|
||||||
// case SelectedField.DataType of
|
|
||||||
// ftSmallint, ftInteger: Editor := integerDbGridControl.Editor(Self);
|
|
||||||
// ftDate: Editor := dateDbGridControl.Editor(Self); // TODO: ftDateTime ftTime
|
|
||||||
// ftCurrency, ftFloat, ftBCD: Editor := doubleDbGridControl.Editor(Self);
|
|
||||||
// // TODO: strings?
|
|
||||||
// end;
|
|
||||||
// end;
|
|
||||||
//end;
|
|
||||||
|
|
||||||
function TJDBGridControl.GetColumns: TJDBGridColumns;
|
function TJDBGridControl.GetColumns: TJDBGridColumns;
|
||||||
begin
|
begin
|
||||||
Result := TJDBGridColumns(inherited Columns);
|
Result := TJDBGridColumns(inherited Columns);
|
||||||
@ -150,35 +136,41 @@ end;
|
|||||||
|
|
||||||
function TJDBGridControl.GetDefaultEditor(Column: integer): TWinControl;
|
function TJDBGridControl.GetDefaultEditor(Column: integer): TWinControl;
|
||||||
var
|
var
|
||||||
//aColumn: TColumn;
|
C: TGridColumn;
|
||||||
|
bs: TColumnButtonStyle;
|
||||||
aField: TField;
|
aField: TField;
|
||||||
begin
|
begin
|
||||||
Result := inherited GetDefaultEditor(Column);
|
Result := inherited GetDefaultEditor(Column);
|
||||||
|
usingControl:= False;
|
||||||
if Result <> nil then
|
if Result <> nil then
|
||||||
begin
|
begin
|
||||||
|
C := ColumnFromGridColumn(Column);
|
||||||
|
bs := C.ButtonStyle;
|
||||||
//aColumn := Columns.Items[Column - 1];
|
//aColumn := Columns.Items[Column - 1];
|
||||||
aField := GetFieldFromGridColumn(Column);
|
aField := GetFieldFromGridColumn(Column);
|
||||||
//if aColumn <> nil then
|
//if aColumn <> nil then
|
||||||
if aField <> nil then;
|
if (aField <> nil) and (bs in [cbsAuto, cbsNone]) then
|
||||||
//case aColumn.Field.DataType of
|
begin
|
||||||
case aField.DataType of
|
usingControl:= True;
|
||||||
ftSmallint, ftInteger: Result := integerDbGridControl.Editor(Self);
|
case aField.DataType of
|
||||||
ftDate: Result := dateDbGridControl.Editor(Self);
|
ftSmallint, ftInteger: Result := integerDbGridControl.Editor(Self);
|
||||||
ftTime: Result := timeDbGridControl.Editor(Self);
|
ftDate: Result := dateDbGridControl.Editor(Self);
|
||||||
ftDateTime: Result := dateTimeDbGridControl.Editor(Self);
|
ftTime: Result := timeDbGridControl.Editor(Self);
|
||||||
ftCurrency, ftFloat: Result :=
|
ftDateTime: Result := dateTimeDbGridControl.Editor(Self);
|
||||||
doubleDbGridControl.Editor(Self, Columns.Items[Column - 1].Decimals);
|
ftCurrency, ftFloat: Result :=
|
||||||
ftBCD: Result := doubleDbGridControl.Editor(Self, aField.Size);
|
doubleDbGridControl.Editor(Self, Columns.Items[Column - 1].Decimals);
|
||||||
|
ftBCD: Result := doubleDbGridControl.Editor(Self, aField.Size);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TJDBGridControl.UpdateData;
|
procedure TJDBGridControl.UpdateData;
|
||||||
begin
|
begin
|
||||||
if not (SelectedField.DataType in [ftSmallInt, ftInteger, ftDate,
|
//if not (SelectedField.DataType in [ftSmallInt, ftInteger, ftDate,
|
||||||
ftTime, ftDateTime, ftCurrency, ftFloat, ftBCD]) then
|
// ftTime, ftDateTime, ftCurrency, ftFloat, ftBCD]) then
|
||||||
|
if not usingControl then
|
||||||
inherited UpdateData;
|
inherited UpdateData;
|
||||||
// TODO... think more about this
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TJDBGridControl.Create(TheOwner: TComponent);
|
constructor TJDBGridControl.Create(TheOwner: TComponent);
|
||||||
|
Reference in New Issue
Block a user