Hi Roberto -
I've attached a simple unit where I demonstrate
creating a panel on a form and assigning it an onClick
method.
I hope this helps!
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes,
Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
NewPanel : TPanel;
procedure ChangeColor(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.ChangeColor(Sender: TObject);
begin
with (Sender as TPanel) do
if Color = clRed then Color := clGreen else Color
:= clRed;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if NewPanel = nil then
begin
NewPanel := TPanel.Create(Form1);
NewPanel.Parent := Form1;
NewPanel.Left := 5;
NewPanel.Top := 10;
NewPanel.Width := 50;
NewPanel.Height := 50;
NewPanel.OnClick := ChangeColor;
end;
end;
end.
--- Roberto Freitas <[EMAIL PROTECTED]>
wrote:
> Hello, I would like to create (on an existing empty
> form) some controls
> at run time, so the appearance of this form would be
> different each
> time it's created and showed.
> These controls would be TTabSheet or TPanel or TEdit
> or TComboBox and
> their owners could be the form itself or some other
> pre-created control.
> After creating each control, I must define it's
> properties.
> My problem is: I don't know how to create the
> controls.
> Could someone show me what are the source lines to
> do it?
>
>
>
>
>
Joe Wilcox
"Reading Cliff Notes to know a novel is like eating Count Chocula to know
steak"
"Nine women cannot have a baby in one month"
[EMAIL PROTECTED]
------------------------ Yahoo! Groups Sponsor --------------------~-->
See what's inside the new Yahoo! Groups email.
http://us.click.yahoo.com/3EuRwD/bOaOAA/yQLSAA/i7folB/TM
--------------------------------------------------------------------~->
-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/delphi-en/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/delphi-en/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/