Sunday, June 12, 2011

1.3 general steps to create applications

1.3 general steps to create applications
  • 1.3.1 create the first application
  • 1.3.2 save applications
  • 1.3.3 run and stop applications
  • 1.3.4 close applications
general steps to create applications (of course we created algorithms and data float diagram - DFD) but we will not discuss here the algorithms and DFD As for the steps are as follows :
  • 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
1.3.1 create the first application

for example we created an application called timers

if you don't undestand to create the form like this, just follow these steps :
  • 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 codeprocedure 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;
now..we try to explain the program above : if we start the progam, it will show form with blank text fields and the button caption "Start". if we click the button( start) the program will fill the time initial implementation of program and change the button caption (start) become (Stop). after that, the program will repeat the procedure TForn.timer1timer, execute every 1 millisecond, so that we can see the time between now and the beginningthe program start.if we click "stop" button then it will change the "stop" button becom "Finish" button. and show the time change. if we click The " Finish "button the program will close. its simple explaining.

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