- 1.3.1 create the first application
- 1.3.2 save applications
- 1.3.3 run and stop applications
- 1.3.4 close applications
- pictures of objects and layout of the window form using the icons of objects in the component palette.
- if necessary, determine the properties of each component using the properties of the object inspector, sometimes the programmers prefer to determine the object's properties through code in the form create.
- write code for events on the desired object. event is an event perceived object, such as point, click, or other events
for example we created an application called timers
- double click on label icons (TLabel) --(tab standard), it will appears label1 in the form. place three lael in the form and change the caption label1 : caption: start,and cotinue with the other label like the picture below.
- double click icons of edit ( TEdit).
- double click button and change the caption : start
- double click timer
- now click F12 toview editor text ( for source code) or double click on the form or object in the form.
- now write the code for first aplication
- double click on the form and type the code
procedure TForm1.FormCreate(Sender: TObject);
begin
timer1.Interval:=1;
end;
- double click on timer1
procedure TForm1.Timer1Timer(Sender: TObject);
var awal,akhir :tdatetime;
lama:real;
slama:string;
begin
if button1.caption='stop' then
begin
akhir:=time;
edit2.Text:=timetostr(akhir);
lama:=(akhir-awal)*100000;
str(lama:12:2,slama);
edit3.Text:=slama;
end;end;
- double click on button1 and type
procedure TForm1.Button1Click(Sender: TObject);
var awal,akhir :tdatetime;
lama:real;
begin
if button1.Caption='start' then
begin
awal:=time;
edit1.Text:=timetostr(time);
button1.Caption:='stop';
end
else if button1.caption='stop'then
button1.Caption:='finish'
else
application.Terminate;end;
1.3.2 Save Applications
before we run the program, its better to save the program. how to save program ? with click save icons or in the Menu fields we find Save Project As. there we save with 2 files. Unit and project.
1.3.3 Run and stop Applications
you can start applications with select the run menu and select Run or just click Run icons. to stop application just click close, and to pause program just click pause icons.
1.3.4 close applications
when you close application , it will show warning to save application or any program have been edicted. if the program have some unit or active form, you can close with select File-->close. if you need to close all select FIle--> close all
No comments:
Post a Comment