Jeg vet ikke hvordan man fjerner feilen når man klikker med musa på knappen, men det virker når du trykker på SPACE eller ENTER. Noen andre som vet?
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
procedure ButtonProc(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
Button: TButton;
implementation
{$R *.dfm}
procedure TForm1.ButtonProc(Sender: TObject);
begin
TButton(Sender).Free;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
x, y, l, t: Integer;
begin
t := 30;
for x := 1 to 10 do
begin
l := 10;
for y := 1 to 10 do
begin
Button := TButton.Create(Self);
with Button do
begin
Left := l;
Top := t;
Caption := 'Destroy me!';
OnClick := ButtonProc;
Parent := Self;
end;
Button := nil;
l := l + 80;
end;
t := t + 30;
end;
end;
end.
-------------------------------------
I am AGAINST TCPA!!
[
http://www.againsttcpa.com/ ]
-------------------------------------
Mvh
DiZpel