You've already forked lazarus-ccr
RxDBGrid - move footers property to FooterOptions
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2313 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -361,7 +361,7 @@ type
|
|||||||
FInProcessCalc: integer;
|
FInProcessCalc: integer;
|
||||||
FAllowedOperations: TRxDBGridAllowedOperations;
|
FAllowedOperations: TRxDBGridAllowedOperations;
|
||||||
//FFooterColor: TColor;
|
//FFooterColor: TColor;
|
||||||
FFooterRowCount: integer;
|
//FFooterRowCount: integer;
|
||||||
FKeyStrokes: TRxDBGridKeyStrokes;
|
FKeyStrokes: TRxDBGridKeyStrokes;
|
||||||
FOnGetCellProps: TGetCellPropsEvent;
|
FOnGetCellProps: TGetCellPropsEvent;
|
||||||
FOptionsRx: TOptionsRx;
|
FOptionsRx: TOptionsRx;
|
||||||
@ -743,6 +743,14 @@ procedure TRxDBGridFooterOptions.SetActive(AValue: boolean);
|
|||||||
begin
|
begin
|
||||||
if FActive=AValue then Exit;
|
if FActive=AValue then Exit;
|
||||||
FActive:=AValue;
|
FActive:=AValue;
|
||||||
|
|
||||||
|
{ TODO : Устаревший код - в следующей версии необходимо убрать }
|
||||||
|
if FActive then
|
||||||
|
FOwner.FOptionsRx:=FOwner.FOptionsRx + [rdgFooterRows]
|
||||||
|
else
|
||||||
|
FOwner.FOptionsRx:=FOwner.FOptionsRx - [rdgFooterRows];
|
||||||
|
|
||||||
|
FOwner.VisualChange;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TRxDBGridFooterOptions.SetColor(AValue: TColor);
|
procedure TRxDBGridFooterOptions.SetColor(AValue: TColor);
|
||||||
@ -1317,10 +1325,6 @@ end;
|
|||||||
|
|
||||||
procedure TRxDBGrid.SetFooterColor(const AValue: TColor);
|
procedure TRxDBGrid.SetFooterColor(const AValue: TColor);
|
||||||
begin
|
begin
|
||||||
{ if FFooterColor = AValue then
|
|
||||||
exit;
|
|
||||||
FFooterOptions.FColor := AValue;
|
|
||||||
Invalidate;}
|
|
||||||
FFooterOptions.Color := AValue;
|
FFooterOptions.Color := AValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1331,11 +1335,6 @@ end;
|
|||||||
|
|
||||||
procedure TRxDBGrid.SetFooterRowCount(const AValue: integer);
|
procedure TRxDBGrid.SetFooterRowCount(const AValue: integer);
|
||||||
begin
|
begin
|
||||||
{ if FFooterRowCount = AValue then
|
|
||||||
exit;
|
|
||||||
FFooterRowCount := AValue;
|
|
||||||
VisualChange;
|
|
||||||
// Invalidate;}
|
|
||||||
FFooterOptions.RowCount:=AValue;
|
FFooterOptions.RowCount:=AValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1374,6 +1373,8 @@ begin
|
|||||||
CalcTitle;
|
CalcTitle;
|
||||||
EndUpdate;
|
EndUpdate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
FFooterOptions.FActive:=rdgFooterRows in FOptionsRx;
|
||||||
VisualChange;
|
VisualChange;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2281,23 +2282,19 @@ var
|
|||||||
TxS: TTextStyle;
|
TxS: TTextStyle;
|
||||||
begin
|
begin
|
||||||
TotalWidth := GetClientRect.Right;
|
TotalWidth := GetClientRect.Right;
|
||||||
// от сель --------------
|
if ScrollBarIsVisible(SB_HORZ) then
|
||||||
if ScrollBarIsVisible(SB_HORZ) then
|
TotalYOffs := GCache.ClientHeight - (GetSystemMetrics(SM_CYHSCROLL) + GetSystemMetrics(SM_SWSCROLLBARSPACING))
|
||||||
TotalYOffs := GCache.ClientHeight - (GetSystemMetrics(SM_CYHSCROLL) +
|
else
|
||||||
GetSystemMetrics(SM_SWSCROLLBARSPACING))
|
TotalYOffs := GCache.ClientHeight;
|
||||||
else
|
|
||||||
TotalYOffs := GCache.ClientHeight;
|
FooterRect := Rect(0, TotalYOffs, TotalWidth, TotalYOffs + DefaultRowHeight * FFooterOptions.RowCount + 2);
|
||||||
// до сель --------------
|
|
||||||
// TotalYOffs := GCache.ClientHeight;
|
|
||||||
FooterRect := Rect(0, TotalYOffs, TotalWidth, TotalYOffs +
|
|
||||||
DefaultRowHeight * FooterRowCount + 2);
|
|
||||||
|
|
||||||
Background := Canvas.Brush.Color;
|
Background := Canvas.Brush.Color;
|
||||||
Canvas.Brush.Color := Color;
|
Canvas.Brush.Color := Color;
|
||||||
Canvas.FillRect(FooterRect);
|
Canvas.FillRect(FooterRect);
|
||||||
|
|
||||||
R.Top := TotalYOffs;
|
R.Top := TotalYOffs;
|
||||||
R.Bottom := TotalYOffs + DefaultRowHeight * FooterRowCount + 2;
|
R.Bottom := TotalYOffs + DefaultRowHeight * FFooterOptions.RowCount + 2;
|
||||||
|
|
||||||
Canvas.Brush.Color := FFooterOptions.FColor;
|
Canvas.Brush.Color := FFooterOptions.FColor;
|
||||||
if (Columns.Count > 0) then
|
if (Columns.Count > 0) then
|
||||||
@ -2403,8 +2400,7 @@ begin
|
|||||||
if FColumnResizing and (MouseToGridZone(X, Y) = gzFixedCols) then
|
if FColumnResizing and (MouseToGridZone(X, Y) = gzFixedCols) then
|
||||||
begin
|
begin
|
||||||
CalcTitle;
|
CalcTitle;
|
||||||
if (rdgFooterRows in OptionsRx) and (dgColumnResize in Options) and
|
if FFooterOptions.Active and (dgColumnResize in Options) and (FFooterOptions.RowCount > 0) then
|
||||||
(FooterRowCount > 0) then
|
|
||||||
DrawFooterRows;
|
DrawFooterRows;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -2781,8 +2777,8 @@ end;
|
|||||||
|
|
||||||
procedure TRxDBGrid.CheckNewCachedSizes(var AGCache: TGridDataCache);
|
procedure TRxDBGrid.CheckNewCachedSizes(var AGCache: TGridDataCache);
|
||||||
begin
|
begin
|
||||||
if (rdgFooterRows in OptionsRx) and (FooterRowCount > 0) then
|
if FFooterOptions.Active and (FooterOptions.RowCount > 0) then
|
||||||
Dec(AGCache.ClientHeight, DefaultRowHeight * FooterRowCount + 2);
|
Dec(AGCache.ClientHeight, DefaultRowHeight * FooterOptions.RowCount + 2);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TRxDBGrid.ColRowMoved(IsColumn: boolean; FromIndex, ToIndex: integer);
|
procedure TRxDBGrid.ColRowMoved(IsColumn: boolean; FromIndex, ToIndex: integer);
|
||||||
@ -2795,7 +2791,7 @@ end;
|
|||||||
procedure TRxDBGrid.Paint;
|
procedure TRxDBGrid.Paint;
|
||||||
begin
|
begin
|
||||||
inherited Paint;
|
inherited Paint;
|
||||||
if (rdgFooterRows in OptionsRx) and (FooterRowCount > 0) then
|
if FFooterOptions.Active and (FFooterOptions.RowCount > 0) then
|
||||||
DrawFooterRows;
|
DrawFooterRows;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2810,8 +2806,8 @@ begin
|
|||||||
CalcStatTotals;
|
CalcStatTotals;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if (rdgFooterRows in OptionsRx) and (FooterRowCount > 0) and
|
if Assigned(FFooterOptions) and FFooterOptions.Active and (FFooterOptions.RowCount > 0) and
|
||||||
DatalinkActive and (DataSource.DataSet.State = dsBrowse) then
|
DatalinkActive and (DataSource.DataSet.State = dsBrowse) then
|
||||||
CalcStatTotals;
|
CalcStatTotals;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2823,7 +2819,7 @@ end;
|
|||||||
procedure TRxDBGrid.MoveSelection;
|
procedure TRxDBGrid.MoveSelection;
|
||||||
begin
|
begin
|
||||||
inherited MoveSelection;
|
inherited MoveSelection;
|
||||||
if (rdgFooterRows in OptionsRx) and (FooterRowCount > 0) then
|
if Assigned(FFooterOptions) and FFooterOptions.Active and (FFooterOptions.RowCount > 0) then
|
||||||
DrawFooterRows;
|
DrawFooterRows;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2986,7 +2982,7 @@ var
|
|||||||
i: integer;
|
i: integer;
|
||||||
APresent: boolean;
|
APresent: boolean;
|
||||||
begin
|
begin
|
||||||
if (not ((rdgFooterRows in OptionsRx) and DatalinkActive)) or (Columns.Count = 0) then
|
if (not (FFooterOptions.Active and DatalinkActive)) or (Columns.Count = 0) then
|
||||||
Exit;
|
Exit;
|
||||||
//Дополнительно проверим - а стоит ли делать пробег по данным - есть ли агрегатные функции
|
//Дополнительно проверим - а стоит ли делать пробег по данным - есть ли агрегатные функции
|
||||||
APresent := False;
|
APresent := False;
|
||||||
@ -3098,7 +3094,7 @@ procedure TRxDBGrid.BeforeDel(DataSet: TDataSet);
|
|||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
begin
|
begin
|
||||||
if (rdgFooterRows in OptionsRx) and (DatalinkActive) then
|
if FFooterOptions.Active and (DatalinkActive) then
|
||||||
for i := 0 to Columns.Count - 1 do
|
for i := 0 to Columns.Count - 1 do
|
||||||
if not TRxColumn(Columns[i]).Footer.DeleteTestValue then
|
if not TRxColumn(Columns[i]).Footer.DeleteTestValue then
|
||||||
begin
|
begin
|
||||||
@ -3113,7 +3109,7 @@ procedure TRxDBGrid.BeforePo(DataSet: TDataSet);
|
|||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
begin
|
begin
|
||||||
if (rdgFooterRows in OptionsRx) and (DatalinkActive) then
|
if FooterOptions.Active and (DatalinkActive) then
|
||||||
for i := 0 to Columns.Count - 1 do
|
for i := 0 to Columns.Count - 1 do
|
||||||
if not TRxColumn(Columns[i]).Footer.PostTestValue then
|
if not TRxColumn(Columns[i]).Footer.PostTestValue then
|
||||||
begin
|
begin
|
||||||
@ -3129,7 +3125,7 @@ procedure TRxDBGrid.ErrorDel(DataSet: TDataSet; E: EDatabaseError;
|
|||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
begin
|
begin
|
||||||
if (rdgFooterRows in OptionsRx) and (DatalinkActive) then
|
if FFooterOptions.Active and (DatalinkActive) then
|
||||||
for i := 0 to Columns.Count - 1 do
|
for i := 0 to Columns.Count - 1 do
|
||||||
if not TRxColumn(Columns[i]).Footer.ErrorTestValue then
|
if not TRxColumn(Columns[i]).Footer.ErrorTestValue then
|
||||||
begin
|
begin
|
||||||
@ -3145,7 +3141,7 @@ procedure TRxDBGrid.ErrorPo(DataSet: TDataSet; E: EDatabaseError;
|
|||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
begin
|
begin
|
||||||
if (rdgFooterRows in OptionsRx) and (DatalinkActive) then
|
if FFooterOptions.Active and (DatalinkActive) then
|
||||||
for i := 0 to Columns.Count - 1 do
|
for i := 0 to Columns.Count - 1 do
|
||||||
if not TRxColumn(Columns[i]).Footer.ErrorTestValue then
|
if not TRxColumn(Columns[i]).Footer.ErrorTestValue then
|
||||||
begin
|
begin
|
||||||
@ -3300,6 +3296,7 @@ begin
|
|||||||
{$IFDEF RXDBGRID_OPTIONS_WO_CANCEL_ON_EXIT}
|
{$IFDEF RXDBGRID_OPTIONS_WO_CANCEL_ON_EXIT}
|
||||||
Options := Options - [dgCancelOnExit];
|
Options := Options - [dgCancelOnExit];
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
FFooterOptions:=TRxDBGridFooterOptions.Create(Self);
|
||||||
|
|
||||||
FKeyStrokes := TRxDBGridKeyStrokes.Create(Self);
|
FKeyStrokes := TRxDBGridKeyStrokes.Create(Self);
|
||||||
FKeyStrokes.ResetDefaults;
|
FKeyStrokes.ResetDefaults;
|
||||||
@ -3329,10 +3326,6 @@ begin
|
|||||||
// FTitleLines := TITLE_DEFAULT;
|
// FTitleLines := TITLE_DEFAULT;
|
||||||
FAllowedOperations := [aoInsert, aoUpdate, aoDelete, aoAppend];
|
FAllowedOperations := [aoInsert, aoUpdate, aoDelete, aoAppend];
|
||||||
|
|
||||||
//FFooterColor:=clWindow;
|
|
||||||
//FFooterColor := clYellow;
|
|
||||||
FFooterRowCount := 0;
|
|
||||||
|
|
||||||
FFilterListEditor := TFilterListCellEditor.Create(nil);
|
FFilterListEditor := TFilterListCellEditor.Create(nil);
|
||||||
with FFilterListEditor do
|
with FFilterListEditor do
|
||||||
begin
|
begin
|
||||||
@ -3354,8 +3347,6 @@ begin
|
|||||||
FRxDbGridDateEditor.Name := 'RxDbGridDateEditor';
|
FRxDbGridDateEditor.Name := 'RxDbGridDateEditor';
|
||||||
FRxDbGridDateEditor.Visible := False;
|
FRxDbGridDateEditor.Visible := False;
|
||||||
|
|
||||||
FFooterOptions:=TRxDBGridFooterOptions.Create(Self);
|
|
||||||
|
|
||||||
UpdateJMenuKeys;
|
UpdateJMenuKeys;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -3791,7 +3782,7 @@ var
|
|||||||
begin
|
begin
|
||||||
if ValueType in [fvtSum, fvtAvg, fvtMax, fvtMin] then
|
if ValueType in [fvtSum, fvtAvg, fvtMax, fvtMin] then
|
||||||
begin
|
begin
|
||||||
F := TRxDBGrid(FOwner.Grid).DataSource.DataSet.FieldByName(FFieldName);
|
F := TRxDBGrid(FOwner.Grid).DataSource.DataSet.FindField(FFieldName);
|
||||||
if Assigned(F) then
|
if Assigned(F) then
|
||||||
begin
|
begin
|
||||||
if F.DataType in [ftDate, ftTime, ftDateTime, ftTimeStamp] then
|
if F.DataType in [ftDate, ftTime, ftDateTime, ftTimeStamp] then
|
||||||
|
Reference in New Issue
Block a user