Все, разобралась. Спасибо большое за подсказки они очень помогли!!!
я в последнем случае ошибку сделала, не в тот метод добавила.
Кидаю рабочий код, вдруг кому-то еще надо будет
_sg1 - StringGrid
bt - проверка, что бы каждый раз при перерисовке форма не вызывалась
Код:
var
Form1: TForm1;
bt:Boolean=false;
implementation
uses Unit2;
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var num,d,i: Integer;
begin
num:=1;
DoubleBuffered:=true;
with Form1._sg1 do
begin
num:=15;
if (num>0) then
begin
if (num>2)then
begin
RowCount:=num+1;
ColCount:=num+1;
end;
d:= trunc((Width-20)/(num+1));
for i:=0 to num do
begin
Cells[0,i]:=IntToStr(i);
Cells[i,0]:=IntToStr(i);
ColWidths[i]:=d;
end;
end;
end;
end;
procedure TForm1._sg1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
var br:TBrush;
acc,arr:Integer;
begin
if (ACol=ARow) then
begin
_sg1.Canvas.Brush.Color:=clRed;
_sg1.Canvas.FillRect(Rect);
end;
if (bt = true) then
begin
if (gdFocused in State) then
begin
if (ACol<>ARow) then
begin
bt:=false;
// ShowMessage('llllll');
end;
end;
end;
end;
procedure TForm1._sg1Click(Sender: TObject);
begin
bt:= True;
Application.CreateForm(TForm2, Form2);
Form2.Edt1.Text:=_sg1.Cells[_sg1.Col, _sg1.Row];
Form2.ShowModal;
_sg1.Cells[_sg1.Col, _sg1.Row]:=Form2.Edt1.Text;
Form2.Free;
end;
Огромадное СПАСИБО всем тем, кто помог в решении данного вопроса.