Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-01

DBGrid painting confusion

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

Hi,

Inside TCustomDBGrid.DefaultDrawColumnCell, the code looks as follows:

--------------------------------------------
procedure TCustomDBGrid.DefaultDrawColumnCell(const Rect: TRect;
  DataCol: Integer; Column: TColumn; State: TGridDrawState);
var
  S: string;
  F: TField;
begin
  F := Column.Field;
  DataCol := GridColumnFromColumnIndex(DataCol);
  if DataCol>=FirstGridColumn then
    case ColumnEditorStyle(DataCol, F) of
      cbsCheckBoxColumn:
        DrawCheckBoxBitmaps(DataCol, Rect, F);
      else begin
        if Fnil then begin
          if F.dataType  ftBlob then
            S := F.DisplayText
          else
            S := '(blob)';
        end else
          S := '';
        DrawCellText(0, DataCol, Rect, State, S);
      end;
    end;
end;
--------------------------------------------

My confusion is the call to DrawCellText(). The parameter list for DrawCellText() is shown below. So why is the method above passing the "DataCol" variable in the aRow parameter? Shouldn't the DataCol be passed as the aCol parameter instead? Also, why is aCol always 0 in the call to DrawCellText()?

 procedure DrawCellText(aCol,aRow: Integer; aRect: TRect; aState:
TGridDrawState; aText: String); virtual;
Regards, - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/

Reply by email

Jesus Reyes
to Graeme Geldenhuys

--- El jue 21-ene-10, Graeme Geldenhuys escribi?:

Show quoted text 9 lines
De:: Graeme Geldenhuys Asunto: [Lazarus] DBGrid painting confusion A: "Lazarus mailing list" Fecha: jueves 21 de enero de 2010, 11:56 Hi, Inside TCustomDBGrid.DefaultDrawColumnCell, the code looks as follows:

snip

Show quoted text 13 lines
My confusion is the call to DrawCellText(). The parameter list for DrawCellText() is shown below. So why is the method above passing the "DataCol" variable in the aRow parameter? Shouldn't the DataCol be passed as the aCol parameter instead?? Also, why is aCol always 0 in the call to DrawCellText()?

I understand the confusion, it was a mix of typo and incomplete implementation, fixed in r 23526.

Jesus Reyes A.

Encuentra las mejores recetas en Yahoo! Cocina.
http://mx.mujer.yahoo.com/cocina/

Reply by email