RxDBGrid - fix error display last data line with active Footer row

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2888 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75
2014-01-19 18:47:05 +00:00
parent 6975302d15
commit 1e13eb1c2d

View File

@ -648,9 +648,7 @@ type
procedure UpdateActive; override; procedure UpdateActive; override;
procedure UpdateData; override; procedure UpdateData; override;
procedure MoveSelection; override; procedure MoveSelection; override;
{$IFDEF RX_USE_LCL_DEVEL}
function GetBufferCount: integer; override; function GetBufferCount: integer; override;
{$ENDIF}
procedure CMHintShow(var Message: TLMessage); message CM_HINTSHOW; procedure CMHintShow(var Message: TLMessage); message CM_HINTSHOW;
procedure FFilterListEditorOnChange(Sender: TObject); procedure FFilterListEditorOnChange(Sender: TObject);
procedure FFilterListEditorOnCloseUp(Sender: TObject); procedure FFilterListEditorOnCloseUp(Sender: TObject);
@ -3144,12 +3142,15 @@ 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) + GetSystemMetrics(SM_SWSCROLLBARSPACING))
else else
TotalYOffs := GCache.ClientHeight; TotalYOffs := GCache.ClientHeight;
}
TotalYOffs := GCache.ClientHeight - (DefaultRowHeight * FFooterOptions.RowCount);
FooterRect := Rect(0, TotalYOffs, TotalWidth, TotalYOffs + DefaultRowHeight * FFooterOptions.RowCount + 2); FooterRect := Rect(0, TotalYOffs, TotalWidth, TotalYOffs + DefaultRowHeight * FFooterOptions.RowCount);
Background := Canvas.Brush.Color; Background := Canvas.Brush.Color;
Canvas.Brush.Color := Color; Canvas.Brush.Color := Color;
@ -3682,7 +3683,11 @@ end;
procedure TRxDBGrid.CheckNewCachedSizes(var AGCache: TGridDataCache); procedure TRxDBGrid.CheckNewCachedSizes(var AGCache: TGridDataCache);
begin begin
if FFooterOptions.Active and (FooterOptions.RowCount > 0) then if FFooterOptions.Active and (FooterOptions.RowCount > 0) then
Dec(AGCache.ClientHeight, DefaultRowHeight * FooterOptions.RowCount + 2); // Dec(AGCache.ClientHeight, DefaultRowHeight * FooterOptions.RowCount);
begin
Dec(AGCache.ClientHeight, DefaultRowHeight * FooterOptions.RowCount);
Dec(AGCache.ScrollHeight, DefaultRowHeight * FooterOptions.RowCount);
end;
end; end;
procedure TRxDBGrid.ColRowMoved(IsColumn: boolean; FromIndex, ToIndex: integer); procedure TRxDBGrid.ColRowMoved(IsColumn: boolean; FromIndex, ToIndex: integer);
@ -3739,12 +3744,11 @@ begin
// UpdateRowsHeight; // UpdateRowsHeight;
end; end;
{$IFDEF RX_USE_LCL_DEVEL}
function TRxDBGrid.GetBufferCount: integer; function TRxDBGrid.GetBufferCount: integer;
var var
H:integer; H:integer;
begin begin
Result := ClientHeight div DefaultRowHeight; { Result := ClientHeight div DefaultRowHeight;
if rdgWordWrap in FOptionsRx then if rdgWordWrap in FOptionsRx then
begin begin
H:=UpdateRowsHeight; H:=UpdateRowsHeight;
@ -3756,9 +3760,14 @@ begin
Dec(Result, RowHeights[0] div DefaultRowHeight); Dec(Result, RowHeights[0] div DefaultRowHeight);
end; end;
if FFooterOptions.Active then if FFooterOptions.Active then
Dec(Result, FFooterOptions.RowCount); Dec(Result, FFooterOptions.RowCount);}
H:=ClientHeight - GCache.FixedHeight;
if FFooterOptions.Active then
H:=H - DefaultRowHeight * FFooterOptions.RowCount;
Result := H div DefaultRowHeight;
// result := (ClientHeight - GCache.FixedHeight - DefaultRowHeight) div DefaultRowHeight;
end; end;
{$ENDIF}
procedure TRxDBGrid.CMHintShow(var Message: TLMessage); procedure TRxDBGrid.CMHintShow(var Message: TLMessage);
var var
@ -3875,8 +3884,8 @@ end;
procedure TRxDBGrid.VisualChange; procedure TRxDBGrid.VisualChange;
begin begin
inherited VisualChange;
CalcTitle; CalcTitle;
inherited VisualChange;
{ if rdgWordWrap in FOptionsRx then { if rdgWordWrap in FOptionsRx then
UpdateRowsHeight;} UpdateRowsHeight;}