I do this code, but the error "unit1.pas(65,18) Error: Identifier not found 'OnArrClick' ", still apears!!
I need help.
------------------------
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ private declarations }
procedure OnArrClick( Sender: TObject );
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure CriarChkBox(); forward;
procedure TForm1.OnArrClick(Sender: TObject);
begin
ShowMessage(Sender.ClassName);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
CriarChkBox;
end;
procedure CriarChkBox();
var
xLeft,yTop: integer; ChkBx:TCheckBox;
begin
xLeft:=2; yTop:=2;
ChkBx:=TCheckBox.Create(Form1);
ChkBx.parent:=Form1;
ChkBx.Top:= yTop;
ChkBx.Left:= xLeft;
ChkBx.Caption := 'ChkBx New';
ChkBx.Checked := True;
ChkBx.OnClick:=OnArrClick;
end;
end.