Buenos dias, les comento... estoy tratando de crear objetos(botones, edit y demas cosas que se me ocurran) en una grilla.. cuando ejecuto el programa recibo este error al hacer la llamada a mi procedimiento
"A control cannot have itself as its parent"
la llamada es
Código:
stgboton(1, StringGrid1, 'hola', EventoClick, 5 );
el procedimiento es este
Código:
procedure stgboton(objeto:integer; Grid : TStringGrid; txtcaption:string; evento:TNotifyEvent; columna:integer);
var
i: Integer;
Btn: TObject;
begin
for i := Grid.FixedRows to Grid.RowCount -2 do
begin
if objeto = 1 then
begin
with TButton (btn) do
begin
Create(nil);
Caption := txtboton;
Width := 87;
Name := 'Button' + IntToStr(i);
BoundsRect:= Grid.CellRect(Columna, i);
ControlStyle := [csClickEvents];
onclick := evento;
Tag := i;
parent:= grid;
end;
Grid.Objects[Columna,i] := Btn;
end;
end;
end;
Alguna idea de como puedo solucionarlo? saludos.