1)Run Delphi
2)Put a label and a button to your form. (They're both under "Standerd" tab)
3)Change the label caption to "hello" (You may change to anything you want actually) at the Object Inspector.
4)Double click on the button and you should see the code.
Code: Select all
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 = class(TForm)
Label1: TLabel;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
end;
end.
Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
begin
7)Then, the exe should pop up, Click the button and then the 'hello' will become 'bye'.
This should be your final code
Code: Select all
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
label1.Caption := 'Bye'
end;
end.