RxDBGrid - in TRxCollumn add event - OnDrawCollumnCell. Event fired on draw current cell only

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2514 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75
2012-09-17 19:52:38 +00:00
parent b1827f8951
commit 1bf39713f0
2 changed files with 28 additions and 21 deletions

View File

@ -362,6 +362,7 @@ type
FImageList: TImageList; FImageList: TImageList;
FKeyList: TStrings; FKeyList: TStrings;
FNotInKeyListIndex: integer; FNotInKeyListIndex: integer;
FOnDrawColumnCell: TDrawColumnCellEvent;
function GetFooter: TRxColumnFooter; function GetFooter: TRxColumnFooter;
function GetKeyList: TStrings; function GetKeyList: TStrings;
procedure SetEditButtons(AValue: TRxColumnEditButtons); procedure SetEditButtons(AValue: TRxColumnEditButtons);
@ -385,6 +386,7 @@ type
property Filter: TRxColumnFilter read FFilter write SetFilter; property Filter: TRxColumnFilter read FFilter write SetFilter;
property DirectInput : boolean read FDirectInput write FDirectInput default true; property DirectInput : boolean read FDirectInput write FDirectInput default true;
property EditButtons:TRxColumnEditButtons read FEditButtons write SetEditButtons; property EditButtons:TRxColumnEditButtons read FEditButtons write SetEditButtons;
property OnDrawColumnCell: TDrawColumnCellEvent read FOnDrawColumnCell write FOnDrawColumnCell;
end; end;
{ TRxDbGridColumns } { TRxDbGridColumns }
@ -2328,6 +2330,10 @@ begin
begin begin
F := GetFieldFromGridColumn(aCol); F := GetFieldFromGridColumn(aCol);
C := ColumnFromGridColumn(aCol) as TRxColumn; C := ColumnFromGridColumn(aCol) as TRxColumn;
if Assigned(C.FOnDrawColumnCell) then
C.OnDrawColumnCell(Self, aRect, aCol, TColumn(ColumnFromGridColumn(aCol)), aState)
else
begin
case ColumnEditorStyle(aCol, F) of case ColumnEditorStyle(aCol, F) of
cbsCheckBoxColumn: DrawCheckBoxBitmaps(aCol, aRect, F); cbsCheckBoxColumn: DrawCheckBoxBitmaps(aCol, aRect, F);
else else
@ -2335,7 +2341,7 @@ begin
begin begin
if F.dataType <> ftBlob then if F.dataType <> ftBlob then
begin begin
{ if Assigned(F.LookupDataSet) and (F.LookupResultField<>'') then { if Assigned(F.LookupDataSet) and (F.LookupResultField<>'') then
S := F.LookupDataSet.FieldByName(F.LookupResultField).DisplayText S := F.LookupDataSet.FieldByName(F.LookupResultField).DisplayText
else} else}
S := F.DisplayText; S := F.DisplayText;
@ -2354,6 +2360,7 @@ begin
DrawCellText(aCol, aRow, aRect, aState, S); DrawCellText(aCol, aRow, aRect, aState, S);
end; end;
end; end;
end;
end; end;
procedure TRxDBGrid.DrawCell(aCol, aRow: integer; aRect: TRect; aState: TGridDrawState); procedure TRxDBGrid.DrawCell(aCol, aRow: integer; aRect: TRect; aState: TGridDrawState);

View File

@ -26,7 +26,7 @@ Copyright (c) 1998 Master-Bank
translate to Lazarus by alexs in 2005 - 2012 translate to Lazarus by alexs in 2005 - 2012
"/> "/>
<License Value="LGPL"/> <License Value="LGPL"/>
<Version Major="2" Minor="2" Release="2" Build="112"/> <Version Major="2" Minor="2" Release="3" Build="114"/>
<Files Count="66"> <Files Count="66">
<Item1> <Item1>
<Filename Value="autopanel.pas"/> <Filename Value="autopanel.pas"/>