DrawGrid on Borland delphi 7.0 - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

DrawGrid on Borland delphi 7.0

I dont know how to get this

[Error] Unit1.pas(123): Undeclared identifier: 'ModeOfCell'

this error is in this source code:

procedure TfrmMain.DrawGridDrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
var
index : integer;
begin
// Calculate the corresponding linear index
index := LinearIndexOf(ARow, ACol);

if ModeOfCell[index] = CELL_INVISIBLE then
begin // if mode is CELL_INVISIBLE, then make the cell black
DrawGrid.Canvas.Brush.Color := clBlack;
DrawGrid.Canvas.FillRect(Rect)
end
else if ModeOfCell[index] = ALREADY_MATCHED then
begin
DrawGrid.Canvas.Brush.Color := clWhite;
DrawGrid.Canvas.FillRect(Rect)
end
else
begin
DrawGrid.Canvas.StretchDraw(Rect,
Images[ImageOfCell[index]].Picture.Graphic);
end
end;

Comments

  • zibadianzibadian Posts: 6,349Member
    : I dont know how to get this
    :
    : [Error] Unit1.pas(123): Undeclared identifier: 'ModeOfCell'
    :
    : this error is in this source code:
    :
    : procedure TfrmMain.DrawGridDrawCell(Sender: TObject; ACol, ARow: Integer;
    : Rect: TRect; State: TGridDrawState);
    : var
    : index : integer;
    : begin
    : // Calculate the corresponding linear index
    : index := LinearIndexOf(ARow, ACol);
    :
    : if ModeOfCell[index] = CELL_INVISIBLE then
    : begin // if mode is CELL_INVISIBLE, then make the cell black
    : DrawGrid.Canvas.Brush.Color := clBlack;
    : DrawGrid.Canvas.FillRect(Rect)
    : end
    : else if ModeOfCell[index] = ALREADY_MATCHED then
    : begin
    : DrawGrid.Canvas.Brush.Color := clWhite;
    : DrawGrid.Canvas.FillRect(Rect)
    : end
    : else
    : begin
    : DrawGrid.Canvas.StretchDraw(Rect,
    : Images[ImageOfCell[index]].Picture.Graphic);
    : end
    : end;
    :
    :
    I think you need to specify which object the ModeOfCell[] belongs to. In this case probably DrawGrid. As the code looks now, ModeOfCell[] is either a property of the TfrmMain object or a globally defined array.
  • _yilmaz_yilmaz Posts: 150Member
    Hi;

    ModeOfCell is a globally defined array in that code, it is not a built-in component
    property. (you can download the whole source code of it in
    www.delphi-central.com)

    : I dont know how to get this
    :
    : [Error] Unit1.pas(123): Undeclared identifier: 'ModeOfCell'
    :
    : this error is in this source code:
    :
    : procedure TfrmMain.DrawGridDrawCell(Sender: TObject; ACol, ARow: Integer;
    : Rect: TRect; State: TGridDrawState);
    : var
    : index : integer;
    : begin
    : // Calculate the corresponding linear index
    : index := LinearIndexOf(ARow, ACol);
    :
    : if ModeOfCell[index] = CELL_INVISIBLE then
    : begin // if mode is CELL_INVISIBLE, then make the cell black
    : DrawGrid.Canvas.Brush.Color := clBlack;
    : DrawGrid.Canvas.FillRect(Rect)
    : end
    : else if ModeOfCell[index] = ALREADY_MATCHED then
    : begin
    : DrawGrid.Canvas.Brush.Color := clWhite;
    : DrawGrid.Canvas.FillRect(Rect)
    : end
    : else
    : begin
    : DrawGrid.Canvas.StretchDraw(Rect,
    : Images[ImageOfCell[index]].Picture.Graphic);
    : end
    : end;
    :
    :

Sign In or Register to comment.