Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.