Here's a simple Windows program that's a form with an edit (text) control and a button. It takes whatever you enter into the edit control as your name and shows a message box that says "hello" to you. The Change event handler makes sure that the button is only enabled if you have entered some text.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Edit1: TEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure Edit1Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Edit1Change(Sender: TObject);
begin
if Length(Trim(Edit1.Text)) > 0 then Button1.Enabled := true
else Button1.Enabled := false;
end;
procedure TForm1.Button1Click(Sender: TObject);
var strMessage: String;
begin
strMessage := 'Hello, ' + Trim(Edit1.Text);
Application.MessageBox(PChar(strMessage), 'Hello', MB_OK + MB_ICONINFORMATION);
end;
end.