You've already forked lazarus-ccr
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:
@ -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,58 +4693,59 @@ begin
|
|||||||
CalcCellExtent(acol, arow, aRect);
|
CalcCellExtent(acol, arow, aRect);
|
||||||
|
|
||||||
PrepareCanvas(aCol, aRow, aState);
|
PrepareCanvas(aCol, aRow, aState);
|
||||||
|
if DataSetNotEmpty then
|
||||||
if FGroupItems.Active and Assigned(FGroupItemDrawCur) then
|
|
||||||
begin
|
begin
|
||||||
gRect:=aRect;
|
if FGroupItems.Active and Assigned(FGroupItemDrawCur) then
|
||||||
aRect.Bottom:=aRect.Bottom - DefaultRowHeight - 1;
|
begin
|
||||||
gRect.Top:=aRect.Bottom;
|
gRect:=aRect;
|
||||||
gRect.Bottom:=gRect.Bottom - 2;
|
aRect.Bottom:=aRect.Bottom - DefaultRowHeight - 1;
|
||||||
end;
|
gRect.Top:=aRect.Bottom;
|
||||||
|
gRect.Bottom:=gRect.Bottom - 2;
|
||||||
|
end;
|
||||||
|
|
||||||
if Assigned(FOnGetCellProps) and not (gdSelected in aState) then
|
if Assigned(FOnGetCellProps) and not (gdSelected in aState) then
|
||||||
begin
|
begin
|
||||||
FBackground := Canvas.Brush.Color;
|
FBackground := Canvas.Brush.Color;
|
||||||
FOnGetCellProps(Self, GetFieldFromGridColumn(aCol), Canvas.Font, FBackground);
|
FOnGetCellProps(Self, GetFieldFromGridColumn(aCol), Canvas.Font, FBackground);
|
||||||
Canvas.Brush.Color := FBackground;
|
Canvas.Brush.Color := FBackground;
|
||||||
end;
|
end;
|
||||||
Canvas.FillRect(aRect);
|
Canvas.FillRect(aRect);
|
||||||
|
|
||||||
DrawCellGrid(aCol, aRow, aRect, aState);
|
DrawCellGrid(aCol, aRow, aRect, aState);
|
||||||
|
|
||||||
RxColumn := TRxColumn(ColumnFromGridColumn(aCol));
|
RxColumn := TRxColumn(ColumnFromGridColumn(aCol));
|
||||||
if Assigned(RxColumn) and Assigned(RxColumn.Field) and
|
if Assigned(RxColumn) and Assigned(RxColumn.Field) and
|
||||||
Assigned(RxColumn.ImageList) then
|
Assigned(RxColumn.ImageList) then
|
||||||
begin
|
begin
|
||||||
AImageIndex := StrToIntDef(RxColumn.KeyList.Values[RxColumn.Field.AsString],
|
AImageIndex := StrToIntDef(RxColumn.KeyList.Values[RxColumn.Field.AsString],
|
||||||
RxColumn.NotInKeyListIndex);
|
RxColumn.NotInKeyListIndex);
|
||||||
if (AImageIndex > -1) and (AImageIndex < RxColumn.ImageList.Count) then
|
if (AImageIndex > -1) and (AImageIndex < RxColumn.ImageList.Count) then
|
||||||
DrawCellBitmap(RxColumn, aRect, aState, AImageIndex);
|
DrawCellBitmap(RxColumn, aRect, aState, AImageIndex);
|
||||||
end
|
end
|
||||||
else
|
|
||||||
DefaultDrawCellData(aCol, aRow, aRect, aState)
|
|
||||||
;
|
|
||||||
|
|
||||||
if FGroupItems.Active and Assigned(FGroupItemDrawCur) then
|
|
||||||
begin
|
|
||||||
C := ColumnFromGridColumn(aCol) as TRxColumn;
|
|
||||||
|
|
||||||
if C.FGroupParam.Color <> clNone then
|
|
||||||
Canvas.Brush.Color := C.FGroupParam.Color
|
|
||||||
else
|
else
|
||||||
if FGroupItems.Color <> clNone then
|
DefaultDrawCellData(aCol, aRow, aRect, aState)
|
||||||
Canvas.Brush.Color := FGroupItems.Color
|
;
|
||||||
else
|
|
||||||
Canvas.Brush.Color := Color;
|
|
||||||
|
|
||||||
Canvas.Font.Color:=Font.Color;
|
if FGroupItems.Active and Assigned(FGroupItemDrawCur) then
|
||||||
|
begin
|
||||||
|
C := ColumnFromGridColumn(aCol) as TRxColumn;
|
||||||
|
|
||||||
Canvas.FillRect(gRect);
|
if C.FGroupParam.Color <> clNone then
|
||||||
|
Canvas.Brush.Color := C.FGroupParam.Color
|
||||||
|
else
|
||||||
|
if FGroupItems.Color <> clNone then
|
||||||
|
Canvas.Brush.Color := FGroupItems.Color
|
||||||
|
else
|
||||||
|
Canvas.Brush.Color := Color;
|
||||||
|
|
||||||
if C.FGroupParam.FValueType <> fvtNon then
|
Canvas.Font.Color:=Font.Color;
|
||||||
WriteTextHeader(Canvas, gRect, C.FGroupParam.DisplayText, C.FGroupParam.Alignment);
|
|
||||||
|
Canvas.FillRect(gRect);
|
||||||
|
|
||||||
|
if C.FGroupParam.FValueType <> fvtNon then
|
||||||
|
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);
|
||||||
|
Reference in New Issue
Block a user