Need Datalink or ActiveRecord to be visible in DBGrid descedant
Original Reporter info from Mantis: matthius
-
Reporter name: Matthieu GIROUX
Original Reporter info from Mantis: matthius
- Reporter name: Matthieu GIROUX
Description:
I had to delete for FPC the code which upgrade dbgrid to control using in columns.
You can download Extended components to see dracell using activerecord of datalink.
I can participate to lazarus to upgrade dbgrid to use controls un columns.
The next code can not work with the initial lazarus, because activerecord is not accessible.
PaintTo also does not work.
From http://code.google.com/p/extended/downloads/list
Additional information:
procedure TFWDBGrid.DrawCell(aCol, aRow: {$IFDEF FPC}Integer{$ELSE}Longint{$ENDIF}; aRect: TRect;
aState: TGridDrawState);
var OldActive : Integer;
FBackground: TColor;
begin
if ( ACol > 0 )
and ( ARow >= {$IFDEF FPC}1{$ELSE}IndicatorOffset{$ENDIF} )
and assigned (( TFWGridColumn ( Columns [ ACol - 1 ])).SomeEdit ) Then
with ( TFWGridColumn ( Columns [ ACol - 1 ])).SomeEdit do
Begin
{$IFDEF FPC}
PrepareCanvas(aCol, aRow, aState);
if Assigned(OnGetCellProps) and not (gdSelected in aState) then
begin
FBackground:=Canvas.Brush.Color;
OnGetCellProps(Self, GetFieldFromGridColumn(aCol), Canvas.Font, FBackground);
Canvas.Brush.Color:=FBackground;
end;
{$ELSE}
Canvas.Brush.Color := Color;
{$ENDIF}
Self.Canvas.FillRect(aRect);
OldActive := Datalink.ActiveRecord;
Datalink.ActiveRecord := ARow {$IFDEF FPC}-1{$ELSE}-IndicatorOffset{$ENDIF};
Width := aRect.Right - aRect.Left;
Height := ARect.Bottom - aRect.Top;
ControlState := ControlState + [csPaintCopy];
PaintTo(Self.Canvas.Handle,aRect.Left,aRect.Top);
ControlState := ControlState - [csPaintCopy];
Datalink.ActiveRecord := OldActive;
end
Else
inherited DrawCell(aCol, aRow, aRect, aState);
end;
Mantis conversion info:
- Mantis ID: 19233
- Version: 0.9.30
- Fixed in version: 0.9.31 (SVN)
- Fixed in revision: 30902 (#b46c4b0a)
- Target version: 0.99.0