unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids;
type TMyObject =
class(TObject)
private
Editable : boolean;
end;
TForm1 =
class(TForm)
StringGrid1: TStringGrid;
procedure StringGrid1SelectCell(Sender: TObject; ACol, ARow: Integer;
var CanSelect: Boolean);
private
{ Private-Deklarationen }
Editable : boolean;
MyObject : TMyObject;
public
{ Public-Deklarationen }
procedure AddObjectToGrid(ACol, ARow : integer; Editable : boolean);
function TestForEdit(ACol, ARow : integer):boolean;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.AddObjectToGrid(ACol, ARow : integer; Editable : boolean);
var
MyObject : TMyObject;
begin
MyObject := TMyObject.Create;
MyObject.EditAble := EditAble;
Form1.StringGrid1.Objects[ACol, ARow] := MyObject;
end;
function TForm1.TestForEdit(ACol, ARow : integer):boolean;
begin
MyObject := TMyObject(Stringgrid1.Objects[ACol, ARow]);
result := MyObject.EditAble;
end;
procedure TForm1.StringGrid1SelectCell(Sender: TObject; ACol,
ARow: Integer;
var CanSelect: Boolean);
begin
if TestForEdit (ACol,ARow) = true
then
showmessage ('
zulässig')
else
showmessage ('
nicht zulässig');
end;
end.