RxFPC:fix RxDBGrid drawing for empty datasets - thx BezBorody

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6848 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75
2019-04-18 08:47:25 +00:00
parent 9369e4d3ef
commit 7be72a218f

View File

@ -892,6 +892,7 @@ type
procedure Notification(AComponent: TComponent; Operation: TOperation); override; procedure Notification(AComponent: TComponent; Operation: TOperation); override;
function DatalinkActive: boolean; function DatalinkActive: boolean;
function DataSetNotEmpty: boolean;
procedure AdjustEditorBounds(NewCol,NewRow:Integer); override; procedure AdjustEditorBounds(NewCol,NewRow:Integer); override;
procedure LinkActive(Value: Boolean); override; procedure LinkActive(Value: Boolean); override;
@ -3308,6 +3309,11 @@ begin
DataSource.DataSet.Active; DataSource.DataSet.Active;
end; end;
function TRxDBGrid.DataSetNotEmpty: boolean;
begin
Result := Assigned(DataSource) and Assigned(DataSource.DataSet) and (not DataSource.DataSet.IsEmpty);
end;
procedure TRxDBGrid.AdjustEditorBounds(NewCol, NewRow: Integer); procedure TRxDBGrid.AdjustEditorBounds(NewCol, NewRow: Integer);
begin begin
inherited AdjustEditorBounds(NewCol, NewRow); inherited AdjustEditorBounds(NewCol, NewRow);
@ -4687,7 +4693,8 @@ begin
CalcCellExtent(acol, arow, aRect); CalcCellExtent(acol, arow, aRect);
PrepareCanvas(aCol, aRow, aState); PrepareCanvas(aCol, aRow, aState);
if DataSetNotEmpty then
begin
if FGroupItems.Active and Assigned(FGroupItemDrawCur) then if FGroupItems.Active and Assigned(FGroupItemDrawCur) then
begin begin
gRect:=aRect; gRect:=aRect;
@ -4738,7 +4745,7 @@ begin
if C.FGroupParam.FValueType <> fvtNon then if C.FGroupParam.FValueType <> fvtNon then
WriteTextHeader(Canvas, gRect, C.FGroupParam.DisplayText, C.FGroupParam.Alignment); WriteTextHeader(Canvas, gRect, C.FGroupParam.DisplayText, C.FGroupParam.Alignment);
end; end;
end;
end end
else else
inherited DrawCell(aCol, aRow, aRect, aState); inherited DrawCell(aCol, aRow, aRect, aState);