Pada saat pertama kali Anda menjalankan Delphi, tampilan yang muncul kurang lebih adalah sebagai berikut:

Form
Form adalah tampilan dari program yang Anda buat. Cobalah untuk menjalankan program dengan menekan tombol F9. Anda akan melihat sebuah jendela program yang masih kosong. Tentu saja masih kosong karena Anda belum menambahkan apapun kedalamnya. Meskipun demikian program tersebut telah memiliki perilaku sebagaimana kebanyakan program Windows. Anda dapat menggeser posisinya, mengubah ukurannya, melakukan minimize, maximize, restore, maupun menutup program dengan klik pada tombol silang pada pojok kanan atas jendela. Jika kita menggunakan XE4, saat pertama kali kita menjalankan Delphi, belum ada aplikasi yang dibuat, jadi, kita belum bisa menjalankan aplikasi dengan menekan F9. Buatlah terlebih dahulu dengan klik pada menu File>New>VCL Forms Application – Delphi.
Mengubah penampilan Form
Form adalah obyek program. Setiap obyek program memiliki perilaku tersendiri. Untuk mengubah perilaku obyek program, kita bisa melakukannya melalui jendela Object Inspector. Jendela ini biasanya terdapat pada pojok kiri bawah, tetapi jika jendela ini belum tampak, maka bisa dimunculkan dengan menekan tombol F11.
Ada dua tab yang terdapat pada jendela Object Inspector, yaitu Properties dan Events. Secara mudah, properti dari obyek program akan menentukan penampilan dari obyek tersebut. Sendangkan event akan menentukan bagaimana obyek beraksi dan bereaksi. Pengertian ini sebenarnya tidak tepat demikian, akan tetapi sampai pada tahap ini, anggaplah demikian.
Properti-properti yang paling penting dari sebuah Form (atau mungkin obyek-obyek program lainnya) antara lain adalah:
- Name
Setiap obyek memiliki nama. Properti inilah yang nantinya akan sangat berguna untuk acuan di dalam program. Properti ini sifatnya harus unik untuk seluruh obyek dalam program. Jadi, tidak ada satu obyek program pun yang memiliki nama sama dengan obyek lainnya. Secara default, nama dari obyek Form yang pertama adalah Form1.
- Caption
Caption adalah judul dari obyek program. Jika obyeknya adalah Form, maka caption adalah tulisan yang muncul pada Title Bar. Jika obyeknya adalah tombol, maka caption adalah tulisan pada tombol tersebut. Secara default, caption akan berisi sama dengan nama obyeknya. Cobalah untuk mengganti properti ini menjadi ‘Program Pertama’. Jika Anda menekan tombol F9, maka tampilan program Anda akan menjadi seperti berikut:

Tampilan Program Pertama (XE4) 
Tampilan Program Pertama (Delphi 6) - Width dan Height
Width dan Height adalah ukuran dari obyek program. Anda dapat melakukan perubahan terhadap properti ini dengan cara drag pada obyek atau memasukkan nilai untuk properti ini dari jendela Object Inspector.
- Color
Secara default properti ini akan berisi clBtnFace yaitu warna tombol yang secara otomatis berubah sesuai dengan seting pada Display Properties Windows. Anda dapat mengisi properti ini dengan warna-warna system yaitu warna-warna yang akan berubah sesuai dengan Display Properties, atau dapat pula dengan warna-warna statis yang akan selalu tetap walaupun Display Properties-nya berubah.
Menambahkan obyek program ke dalam Form
Anda dapat menambahkan obyek-obyek program ke dalam Form dengan obyek apa saja yang Anda suka sebanyak yang Anda suka. Tentu saja pertimbangannya bukan suka atau tidak suka tetapi lebih pada pertimbangan kebutuhan program.
TButton
Salah satu obyek program yang paling penting adalah Button. Untuk menambahkan obyek Button ke dalam Form, klik komponen Button pada Component Palette. Setelah komponen tersebut tampak terpilih, klik pada Form pada posisi yang diinginkan lalu drag untuk menentukan ukurannya.

Obyek Button pertama secara otomatis akan diberi nama Button1 dengan caption yang sama dengan namanya. Anda bisa mengganti properti name maupun captionnya melalui Object Ispector. Tetapi untuk sementara, kita belum banyak berkepentingan dengan mengganti properti-propertinya.
Seperti yang sudah kita bahas di atas, selain properti, obyek memiliki event, yaitu bagaimana obyek beraksi dan bereaksi. Salah satu event yang paling penting dari obyek dengan tipe TButton adalah event OnClick, yaitu aksi yang dilakukan oleh program jika sebuah obyek Button diklik. Anda dapat mengisi event-event ini sekaligus melihat event apa saja yang dimiliki oleh sebuah Button melalui Object Inspector. Akan tetapi untuk sekedar mengisi even OnClick dari sebuah Button, Anda cukup klik ganda pada obyek Button tersebut.
Jika Anda klik ganda obyek Button tersebut, maka Anda akan dibawa menuju code editor untuk event OnClick dari obyek Button tersebut seperti berikut:
procedure TForm1.Button1Click(Sender: TObject); begin | end;
Kode untuk event tersebut masih kosong. Sekarang cobalah untuk menambahkan sebuah perintah ke dalamnya sehingga event tersebut menjadi seperti berikut:
procedure TForm1.Button1Click(Sender: TObject); begin Button1.Caption:='Clicked'; end;
Jalankan program dengan menekan tombol F9. Saat pertama kali program berjalan, maka tampilannya kurang lebih adalah seperti berikut (tergantung ukuran maupun posisi yang Anda buat):

Jika Anda klik pada tombol, maka tulisan pada tombol akan berubah.

Proses yang terjadi adalah sebagai berikut:
Jika tombol diklik, maka prosedur yang dihubungkan ke event OnClick dari tombol tersebut akan dijalankan. Dalam hal ini prosedur tersebut adalah prosedur TForm1.Button1Click yang di dalamnya terdapat perintah untuk mengganti properti caption dari Button1.
Tanda titik
Untuk mengacu suatu properti dari sebuah obyek, maka pertama kali tulis nama obyeknya, diikuti dengan titik, lalu diikuti dengan nama propertinya. Jadi untuk mengacu properti caption dari obyek tombol yang memiliki nama Button1, maka penulisannya menjadi Button1.Caption.
Operator penugasan
Operator penugasan adalah operator yang berfungsi untuk mengisi obyek di sebelah kiri tanda dengan obyek disebelah kanan tanda. Operator penugasan pada matematika adalah tanda sama dengan (=), akan tetapi Delphi menggunakan tanda titik dua sama dengan (:=). Antara titik dua dan sama dengan tidak boleh dipisah.
String
String adalah data berupa untaian karakter. Penulisan string di dalam Delphi harus diapit dengan tanda petik tunggal (gunakan tanda petik yang berada satu tombol dengan petik ganda, bukan tanda petik yang berada di sebelah kiri tombol 1).
Sekarang kita bisa memahami arti dari
Button1.Caption:='Clicked';
sebagai perintah untuk mengisi properti caption (yang merupakan untaian karakter) dari obyek Button1 dengan string (untaian karakter) ‘Clicked’.
Titik koma
Titik koma digunakan untuk menandakan akhir statemen program. Sebuah statemen program boleh dipisah menjadi beberapa baris. Selama belum ditemukan tanda titik koma, maka baris-baris tersebut masih dianggap sebagai sebuah statemen program.
TLabel
Label adalah sebuah komponen yang berfungsi untuk menampilkan informasi berupa string. Tambahkan komponen ini ke dalam Form di bawah Button1 sehingga terlihat seperti gambar berikut:

Nama obyek label pertama secara otomatis adalah Label1, demikian juga dengan properti captionnya.
Sekarang gantilah baris perintah:
Button1.Caption:='Clicked';
Menjadi:
Label1.Caption:='Clicked';
Jalankan program, lalu klik pada tombol. Yang berubah adalah tulisan di bawah tombol, bukan tulisan pada tombol.
Tipe data
Jika kita berbicara tentang program, maka kita tidak bisa lepas dari pembicaraan mengenai tipe data. Secara garis besar ada dua macam tipe data sederhana yang mendasar, yaitu tipe bilangan dan tipe karakter. Tipe bilangan kemudian dibagi lagi menjadi beberapa kelompok. Demikian juga dengan tipe karakter.
Data di dalam program disimpan di dalam sebuah media penyimpan yang disebut dengan variabel. Variabel dengan tipe data bilangan hanya bisa menerima data berupa bilangan. Demikian juga variabel dengan tipe karakter hanya bisa menerima data berupa karakter. Perbedaan yang lebih penting lagi adalah bahwa tipe bilangan bisa digunakan untuk operasi aritmatika, sedangkan tipe karaktier tidak bisa. Pengelompokan tipe data seperti ini bukanlah pengelompokan tipe data menurut definisi Delphi, akan tetapi pengelompokan seperti ini hanyalah ulah saya semata untuk menyederhanakan pembicaraan. Secara perlahan kita akan memperbaiki pengertian dari tipe data.
Perincian mengenai tipe data adalah sebagai berikut:
Tipe data bilangan
Ada dua macam tipe data bilangan yaitu bilangan bulat dan bilangan pecahan.
| Tipe data | Jangkauan | Ukuran |
| Integer | –2147483648..2147483647 | 32-bit |
| Shortint | –128..127 | 8-bit |
| Smallint | –32768..32767 | 16-bit |
| Longint | –2147483648..2147483647 | 32-bit |
| Int64 | –2^63..2^63–1 | 64-bit |
| Byte | 0..255 | 8-bit |
| Word | 0..65535 | 16-bit |
| Longword | 0..4294967295 | 32-bit |
| Tipe data | Jangkauan | Digit penting | Ukuran (byte) |
| Real48 | 2.9 x 10^–39 .. 1.7 x 10^38 | 11–12 | 6 |
| Single | 1.5 x 10^–45 .. 3.4 x 10^38 | 7–8 | 4 |
| Double | 5.0 x 10^–324 .. 1.7 x 10^308 | 15–16 | 8 |
| Extended | 3.6 x 10^–4951 .. 1.1 x 10^4932 | 19–20 | 10 |
| Comp | –2^63+1 .. 2^63 –1 | 19–20 | 8 |
| Currency | –922337203685477.5808.. 922337203685477.5807 | 19–20 | 8 |
Pembagian tipe data yang bermacam-macam digunakan untuk mendapatkan efisiensi. Sebagai contoh, jika kita akan menyimpan data hari dalam satu bulan yang maksimal adalah 31 hari, maka kita bisa menggunakan tipe data byte yang memiliki jangkauan 0..255. Walaupun kita bisa menggunakan tipe integer, tetapi penggunaan integer merupakan pemborosan karena integer membutuhkan 32 bit (4 byte) memori, sedangkan byte hanya membutuhkan 8 bit.
Penugasan antara dua variabel dengan tipe data yang berbeda akan menyebabkan hal-hal sebagai berikut:
- Tipe pecahan boleh ditugasi dengan tipe bilangan bulat, tetapi tidak sebaliknya.
- Tipe dengan jangkauan yang lebih besar bisa ditugasi dengan tipe dengan jangkauan lebih kecil tanpa ada masalah. Akan tetapi jika tipe dengan jangkauan lebih kecil ditugasi dengan tipe yang memiliki jangkauan lebih besar, maka data akan terpotong sehingga menghasilkan perhitungan yang mungkin salah.
Tipe karakter
Data dengan tipe karakter adalah data yang menyimpan karakter dari a..z, A..Z, 0..9, maupun semua karakter yang terdapat pada keyboard. Sebenarnya karakter-karakter tersebut juga memiliki nilai ordinal yang dimulai dari 0 hingga 255. Oleh karena itu tipe karakter memiliki ukuran yang sama dengan tipe byte. String seperti yang sudah kita gunakan pada percobaan dengan caption adalah untaian karakter.
Selain tipe-tipe seperti yang sudah disebutkan di atas, masih terdapat banyak sekali tipe-tipe data yang lain. Bahkan kita juga bisa membuat tipe data sendiri.
Variabel
Di atas sudah disebutkan bahwa untuk menyimpan data, kita membutuhkan media penyimpan yang disebut dengan variabel. Sebelum kita bisa menggunakan variabel, terlebih dahulu kita harus mendeklarasikannya. Untuk mendeklarasikan variabel, kita membutuhkan sebuah kata kunci var kemudian diikuti oleh nama variabelnya, diikuti oleh titik dua, kemudian diikuti oleh tipe datanya, kemudian ditutup dengan tanda titik koma.
Penambahan kata kunci var cukup dilakukan sekali saja selama belum ditemukan kata kunci yang lain.
Program yang sudah kita buat telah memiliki satu variabel dengan nama Form1 yang memiliki tipe data TForm1. Jika kita lihat pada code editor, program yang sudah kita buat memiliki listing lengkap seperti berikut (XE4):
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils,
System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs;
type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
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:='Clicked';
end;
end.TForm1 adalah tipe data yang kita buat sendiri. Akan tetapi pembuatan tersebut dilakukan secara otomatis oleh Delphi sesuai dengan pengaturan yang kita lakukan.
Percobaan variabel
Pada program yang pertama kita buat, saat pertama program dijalankan, tulisan yang muncul di bawah tombol adalah ‘Label1’. Setelah tombol diklik, tulisan berubah menjadi ‘Clicked’. Kita akan mencoba membuat program dengan aksi yang berbeda. Saat pertama kali program berjalan, tulisan di bawah tombol adalah angka nol. Setiap tombol diklik, angka di bawah tombol akan naik.
Bukalah kembali Program Pertama, lalu gantilah properti caption dari Button1 menjadi ‘Naik’ dan caption dari Label1 menjadi ‘0’. Buatlah sebuah variabel dengan nama Angka dengan tipe data integer. Cara melakukannya adalah dengan menambahkan baris di bawah deklarasi Form1 seperti:
var Form1: TForm1; Angka: integer;
Setelah itu, gantilah prosedur TForm1.Button1Click menjadi sebagai berikut:
procedure TForm1.Button1Click(Sender: TObject); begin Angka:=Angka+1; Label1.Caption:=IntToStr(Angka); end;
When the first time you run Delphi, display that appears more or less are as follows:


Form
Form is the display of the program that you created. Try to run the program by pressing the F9 key. You will see a program window which is still empty. Of course still empty because you have not added any to them. However, the program has had a behavior as most Windows programs. You can shift its position, modify its size, does minimize, maximize, restore, and close the program by clicking on the cross button on the top right corner of the window. If we use the XE4, the first time we are running Delphi, there has been no application made, so we haven’t been able to run the application by pressing F9. Make in advance by clicking on the menu File>New>VCL Forms Application – Delphi.
Change the appearance of the Form
The Form is an object of the program. Each object of the program has its own behavior. To change the behavior of the object of the program, we can do it through the window of the Object Inspector. This window usually found at the bottom left corner, but if this window is not visible, it can be displayed by pressing the F11.
There are two tabs in the Object Inspector window, Properties and Events. Easily, the properties of the object the program will determine the appearance of the object. While the event will determine how the object will act and react. Actually this explanation is not exactly like so, yet until this step please just consider like so.
The properties that are most important from a Form (or perhaps other program objects) ie are:
- Name
Each object has a name. This is the property that will be very useful for reference in the program. This property must be unique for the entire objects in the program. So, there is no single program object that has a name equal to the other object. By default, the name of the first Form object is Form1.
- Caption
Caption is the title of the program object. If the object is a Form, then the caption is the text that appears in the Title Bar. If the object is a button, then the caption is the text on the button. By default, the caption will contain the same as the name of the object. Try to change this property to ‘First Program’ . If you press the F9 key, then Your program display will be as follows:

Appearance of First Program (XE4) 
Appearance of First Program (Delphi 6) - Width and Height
Width and Height are the size of the program object. You can make changes to the property by way of drag on an object or enter a value for this property of the Object Inspector window.
- Color
By default this property will contain clBtnFace ie the buttons colours which is automatically changes according to the settings on the Display Properties of Windows. You can fill it with system colors which are the colors that will changes according to the Display Properties, or may with static colors that will always remain even though the Display Properties changes.
Add the program object into the Form
You can add objects of the program into the Form with any object you like as much as you like. Of course the reasoning does not like or don’t like but more in consideration of the needs of the program.
TButton
One of the most important program object is Button. To add object Button into the Form, click the Button component in the Component Palette. After that component appear selected, click on the desired position on the Form and drag to define its size.

The object of the first Button will automatically be named Button1 with a caption equal with its name. You can change the name or caption property via the Object Ispector. But for now, we don’t need to put much concerns in changing its properties.
As we have discussed above, in addition to the properties, the object has an event, how the object act and react. One of the most important event of the object with the type of TButton is OnClick event, i.e. actions committed by the program if a Button object is clicked. You can fill these events and see what event is owned by a Button through the Object Inspector. But to simply populate the event OnClick of a Button, you can simply double-click on the Button object.
If you double click on a Button object, then you will be taken to the code editor to the event OnClick of the Button object as follows:
procedure TForm1.Button1Click(Sender: TObject); begin | end;
The code for the event is still empty. Now try to add a code into it so that the event is as follows:
procedure TForm1.Button1Click(Sender: TObject); begin Button1.Caption:='Clicked'; end;
Run the program by pressing the F9 key. The first time the program is run, then it looks more or less are as follows (depending on the size and position you created):

If you click on the button, then the text on the button will change.

The process that occurs is as follows:
If the button is clicked, then the procedures linked to the event OnClick of the button will be executed. In this case the procedure is procedure TForm1.Button1Click in which there is a command to change the caption property of Button1.
Dot
To refer to a property of an object, first, write the name of the object, followed by a dot, and then followed by the name of its property. So to refer to the caption property from the button object named Button1, then we write it as Button1.Caption.
Assignment Operator
The Assignment Operator is an operator that serves to fill the object on the left side of the sign with the object on the right sign. The Assignment Operator in mathematics is the equal sign (=), but Delphi using colon equals (:=). Between the colon and equal sign must not be separated.
String
String type is a string of characters. Writing strings in Delphi must be enclosed with single quotation marks (use quotation marks that are the same button with double quotation, not quotation marks which are to the left of the 1 key).
Now we can understand the meaning of
Button1.Caption:='Clicked';
as command to populate the property caption (which is a string of characters) of the Button1 object with the string (character string) ‘Clicked’.
Semicolon
Semicolon is used to indicate the end of the program statement. A program statement can be divided into several lines. As long as semicolon is not yet found, then the lines are still regarded as one statement of the program.
TLabel
The Label is a component that serves to display the information in the form of a string. Add this component into the Form below Button1 so it looks like the following figure:

The object name of the first label is Label1 automatically, as well as the captionnya property.
Now, change the command line:
Button1.Caption:='Clicked';
Into:
Label1.Caption:='Clicked';
Run the program and click on the button. What is changed is the text below the button, not the text on the button.
Data type
If we are talking about the program, it cannot be separated from discussion about data types. Basically, there are two kinds of simple and fundamental data types, i.e, the numeric and character type. Numeric type are further divided into several groups. Likewise with character type.
The Data in the program is stored in a storage medium that is called with the variable. Variable with the numeric data type can only receive data in the form of numbers. Similarly, a variable with a type character can only receive data in the form of characters. The more important difference is that the type of numeric can be used for arithmetic operations, while the type karaktier can not. The classification of data types such as this is not a grouping of data types according to the definition of Delphi, but grouping like this is just the way I am merely to simplify the discussion. Gradually, we will improve understanding of the data type.
Details about the data types are as follows:
Numeric data type
There are two kinds of numeric data type i.e. integers and fractional.
| Data type | Range | Size |
| Integer | –2147483648..2147483647 | 32-bit |
| Shortint | –128..127 | 8-bit |
| Smallint | –32768..32767 | 16-bit |
| Longint | –2147483648..2147483647 | 32-bit |
| Int64 | –2^63..2^63–1 | 64-bit |
| Byte | 0..255 | 8-bit |
| Word | 0..65535 | 16-bit |
| Longword | 0..4294967295 | 32-bit |
| Data type | Range | Significant Digit | Size (byte) |
| Real48 | 2.9 x 10^–39 .. 1.7 x 10^38 | 11–12 | 6 |
| Single | 1.5 x 10^–45 .. 3.4 x 10^38 | 7–8 | 4 |
| Double | 5.0 x 10^–324 .. 1.7 x 10^308 | 15–16 | 8 |
| Extended | 3.6 x 10^–4951 .. 1.1 x 10^4932 | 19–20 | 10 |
| Comp | –2^63+1 .. 2^63 –1 | 19–20 | 8 |
| Currency | –922337203685477.5808.. 922337203685477.5807 | 19–20 | 8 |
The Division of the various data types used to gain efficiency. For example, if we are going to keep track of the day in a month that the maximum is 31 days, then we can use the byte data type has a range of 0 .. 255. Although we can use the integer type, but the use of an integer is a waste because the integer takes 32 bits (4 bytes) of memory, while byte requiring only 8 bit.
The assignment between two variable with a different data type will cause the following things:
- Fractional type can be assigned by the integer type, but not vice versa.
- Type with greater range could be assigned by a smaller range of types without any problem. However, if a type with a smaller range is assigned by the type that has a greater range, then the data will be truncated which will produce calculations that might be wrong.
Characters type
The Data with character type is the data that saves the character from a. ..z, a..Z, 0 .. 9, as well as all the character found on the keyboard. The characters actually also has the ordinal value starts from 0 to 255. It is therefore a character type of data has the same size with byte type. Strings as we have used in the experiment with the caption is a string of characters.
In addition to the types as already mentioned above, there are a lot of another data types. In fact we can also make our own data type.
Variable
Above already mentioned that in order to save the data, we need the storage medium are called variables. Before we can use a variable, first we have to declare it. To declare a variable, we need a keyword var followed by the name of variabelnya, followed by a colon, followed by the type of data, then closed with a semicolon.
The addition of keywords var only needed once as long as there is no other keywords added.
The Program we have created has had a variable with the name of Form1 has the data type TForm1. If we see in the code editor, the complete listing is as follows (XE4):
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils,
System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs;
type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
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:='Clicked';
end;
end.TForm1 is data type that we make ourselves. But the creation is done automatically by Delphi in accordance with the arrangements we do.
Experiment of variables
On the first program that we make, the first time the program is executed, text that appear below the button is ‘Label1’. After the button is clicked, the text changed into ‘Clicked’. We will try to create a program with a different action. The first time the program is run, the text bellow the button is number zero. Every time button is clicked, the number bellow the button will go up.
Reopen the first Program, and then change the caption property of Button1 to ‘Up’ and caption of Label1 to ‘0’. Create a variable named Number with data type of integer. How to do this is by adding the line below Form1 declarations as follows:
var Form1: TForm1; Number: integer;
After that, change the procedure TForm1.Button1Click to become as follows:
procedure TForm1.Button1Click(Sender: TObject); begin Number:=Number+1; Label1.Caption:=IntToStr(Number); end;



Terimakasih Ilmunya Pak Semoga bermanfaat
type data int bukan 2 byte ya ?
Tipe data itu bisa berbeda-beda ukurannya tergantung kompilernya. Untuk Delphi, integer itu 4 byte. Tapi ingat, itu integer, bukan int.