Board index » delphi » TPanel.Create question???

TPanel.Create question???

Hi!
How do you make a procedure on a panel if you Created it in runtime, with
the TPanel.Create command?

Example:

I want to close the program when I click on a TPanel that I created with
TPanel.Create procedure...

///SimonR

 

Re:TPanel.Create question???


Simon,

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls;

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
    Panel: TPanel;
    procedure PanelClick(Sender: TObject);
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.PanelClick(Sender: TObject);
begin
  Close;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Panel:= TPanel.Create(Self);
  Panel.Parent:= Self;
  Panel.Left:= 50;
  Panel.Top:= 50;
  Panel.OnClick:= PanelClick;
end;

end.

Happy New Year,

Bob

Sent using Virtual Access 5.01 - download your freeware copy now
http://www.atlantic-coast.com/downloads/vasetup.exe

Re:TPanel.Create question???


Thx!
And a happy new to you to =)

/SimonR

Other Threads