Membuat aplikasi konversi detik dengan lazarus


tampilan awal saat dijalankan   🙂

ini source code nya

unit Unit1;

{$mode objfpc}{$H+}

interface

uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
ExtCtrls, Buttons;

type

{ TForm1 }

TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Edit1: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
SpeedButton1: TSpeedButton;
Timer1: TTimer;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Edit1Change(Sender: TObject);
procedure Label2Click(Sender: TObject);
procedure Label3Click(Sender: TObject);
procedure Label4Click(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;

var
Form1: TForm1;
jam, menit, detik, sisa, input:longint;
ADate: TDateTime;
hari: array[1..7] of string;

implementation

{$R *.lfm}

{ TForm1 }

procedure TForm1.Label2Click(Sender: TObject);
begin
label2.Caption;
end;

procedure TForm1.Label3Click(Sender: TObject);
begin
label3.Caption;
end;

procedure TForm1.Label4Click(Sender: TObject);
begin
label4.Caption;
end;

procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
edit1.Clear;
label2.Caption:=”;
edit1.SetFocus;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
hari[1]:= ‘Minggu’;
hari[2]:= ‘Senin’;
hari[3]:= ‘Selasa’;
hari[4]:= ‘Rabu’;
hari[5]:= ‘Kamis’;
hari[6]:= ‘Jumat’;
hari[7]:= ‘Sabtu’;
ADate := Date;
label3.Caption:=hari[DayOfWeek(ADate)]+’/’+datetimetostr(date);
label4.Caption:=formatdatetime(‘hh:nn:ss’, now);
end;

procedure TForm1.Edit1Change(Sender: TObject);
begin
edit1.SetFocus;
end;

procedure TForm1.Button1Click(Sender: TObject);

begin
input:= strtoint(edit1.Text);
jam:=input div 3600;
sisa:= input mod 3600;
menit:= sisa div 60;
detik:= sisa mod 60;
label2.Font.Style:= [fsbold];
label2.Caption:=’hasil dari konversi adalah :’+inttostr(jam)+’jam’+inttostr(menit)+’menit’+inttostr(detik)+’detik’;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
close;
end;

end.

setelah di inputkan hasilnya seperti dibawah ini

untuk aplikasinya bisa di download di sini.

semoga membantu  ^_^

Iklan

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s