PERCOBAAN 7
MEMBUAT PETA PATROLI
(Mengunakan Delphi XE8)
1. Tujuan. Agar Bamasis mampu membuat Algoritma Penghitung.
2. Alat dan Bahan.
a. Laptop/PC;
b. Aplikasi Delphi;
c. Tshape;
d. Tbutton
e. Timage.
f. Tedit.
g. Timer.
3. Dasar Teori
a. Tshape adalah salah satu komponen visual dalam Delphi yang digunakan untuk menggambar bentuk geometris sederhana seperti persegi panjang, lingkaran, elips, atau garis di dalam sebuah form atau container lainnya. TShape sangat berguna untuk membuat elemen visual yang sederhana.
b. TButton digunakan untuk membuat tombol (button) di antarmuka pengguna. TButton memungkinkan pengguna untuk memicu suatu aksi atau perintah ketika tombol tersebut diklik. Tombol sangat berguna dalam aplikasi Delphi untuk menjalankan berbagai macam perintah.
d. TEdit Dalam Delphi 8, fungsi t edit biasanya merujuk pada komponen TEdit, yang digunakan untuk membuat kontrol input teks di antarmuka pengguna. Komponen ini memungkinkan pengguna untuk mengetikkan teks atau memodifikasi teks yang sudah ada.
4. Langkah Percobaan.
a. Flowchart;
b. Buat Coding untuk menampilkan Data diri. Berikut adalah contoh program sederhana:
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.Imaging.jpeg,
Vcl.StdCtrls;
type
TForm1 = class(TForm)
Image1: TImage;
Shape1: TShape;
Shape2: TShape;
Shape3: TShape;
Shape4: TShape;
Shape5: TShape;
Shape6: TShape;
Shape7: TShape;
Shape8: TShape;
Shape9: TShape;
Shape10: TShape;
Shape11: TShape;
Shape12: TShape;
Shape13: TShape;
Shape14: TShape;
Shape15: TShape;
Shape16: TShape;
Shape17: TShape;
Shape18: TShape;
Shape19: TShape;
Shape20: TShape;
Shape21: TShape;
Shape22: TShape;
Shape23: TShape;
Shape24: TShape;
Shape25: TShape;
Shape26: TShape;
Shape27: TShape;
Shape28: TShape;
Shape29: TShape;
Shape30: TShape;
Shape31: TShape;
Shape32: TShape;
Shape33: TShape;
Shape34: TShape;
Shape35: TShape;
Shape36: TShape;
Edit1: TEdit;
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
if edit1.text='11' then
begin
shape1.Visible:=true; shape2.visible:=false; shape3.Visible:=false;
edit1.Text:='';
end;
if edit1.text='12' then
begin
shape1.Visible:=false; shape2.visible:=true; shape3.Visible:=false;
edit1.Text:='';
end;
if edit1.text='13' then
begin
shape1.Visible:=false; shape2.visible:=false; shape3.Visible:=true;
edit1.Text:='';
end;
if edit1.text='21' then
begin
shape4.Visible:=true; shape5.visible:=false; shape6.Visible:=false;
edit1.Text:='';
end;
if edit1.text='22' then
begin
shape4.Visible:=false; shape5.visible:=true; shape6.Visible:=false;
edit1.Text:='';
end;
if edit1.text='23' then
begin
shape4.Visible:=false; shape5.visible:=true; shape6.Visible:=false;
edit1.Text:='';
end;
if edit1.text='31' then
begin
shape7.Visible:=true; shape8.visible:=false; shape9.Visible:=false;
edit1.Text:='';
end;
if edit1.text='32' then
begin
shape7.Visible:=false; shape8.visible:=true; shape9.Visible:=false;
edit1.Text:='';
end;
if edit1.text='33' then
begin
shape7.Visible:=false; shape8.visible:=false; shape9.Visible:=true;
edit1.Text:='';
end;
if edit1.text='41' then
begin
shape10.Visible:=true; shape11.visible:=false; shape12.Visible:=false;
edit1.Text:='';
end;
if edit1.text='42' then
begin
shape10.Visible:=false; shape11.visible:=true; shape12.Visible:=false;
edit1.Text:='';
end;
if edit1.text='43' then
begin
shape10.Visible:=false; shape11.visible:=false; shape12.Visible:=true;
edit1.Text:='';
end;
if edit1.text='51' then
begin
shape13.Visible:=true; shape14.visible:=false; shape15.Visible:=false;
edit1.Text:='';
end;
if edit1.text='52' then
begin
shape13.Visible:=false; shape14.visible:=true; shape15.Visible:=false;
edit1.Text:='';
end;
if edit1.text='53' then
begin
shape13.Visible:=false; shape14.visible:=false; shape15.Visible:=true;
edit1.Text:='';
end;
if edit1.text='61' then
begin
shape16.Visible:=true; shape17.visible:=false; shape18.Visible:=false;
edit1.Text:='';
end;
if edit1.text='62' then
begin
shape16.Visible:=false; shape17.visible:=true; shape18.Visible:=false;
edit1.Text:='';
end;
if edit1.text='63' then
begin
shape16.Visible:=false; shape17.visible:=false; shape18.Visible:=true;
edit1.Text:='';
end;
if edit1.text='71' then
begin
shape19.Visible:=true; shape20.visible:=false; shape21.Visible:=false;
edit1.Text:='';
end;
if edit1.text='72' then
begin
shape19.Visible:=false; shape20.visible:=true; shape21.Visible:=false;
edit1.Text:='';
end;
if edit1.text='73' then
begin
shape19.Visible:=false; shape20.visible:=false; shape21.Visible:=true;
edit1.Text:='';
end;
if edit1.text='81' then
begin
shape22.Visible:=true; shape23.visible:=false; shape24.Visible:=false;
edit1.Text:='';
end;
if edit1.text='82' then
begin
shape22.Visible:=false; shape23.visible:=true; shape24.Visible:=false;
edit1.Text:='';
end;
if edit1.text='83' then
begin
shape22.Visible:=false; shape23.visible:=false; shape24.Visible:=true;
edit1.Text:='';
end;
if edit1.text='91' then
begin
shape25.Visible:=true; shape26.visible:=false; shape27.Visible:=false;
edit1.Text:='';
end;
if edit1.text='92' then
begin
shape25.Visible:=false; shape26.visible:=true; shape27.Visible:=false;
edit1.Text:='';
end;
if edit1.text='93' then
begin
shape25.Visible:=false; shape26.visible:=false; shape27.Visible:=true;
edit1.Text:='';
end;
if edit1.text='101' then
begin
shape28.Visible:=true; shape29.visible:=false; shape30.Visible:=false;
edit1.Text:='';
end;
if edit1.text='102' then
begin
shape28.Visible:=false; shape29.visible:=true; shape30.Visible:=false;
edit1.Text:='';
end;
if edit1.text='103' then
begin
shape28.Visible:=false; shape29.visible:=false; shape30.Visible:=true;
edit1.Text:='';
end;
if edit1.text='111' then
begin
shape31.Visible:=true; shape32.visible:=false; shape33.Visible:=false;
edit1.Text:='';
end;
if edit1.text='112' then
begin
shape31.Visible:=false; shape32.visible:=true; shape33.Visible:=false;
edit1.Text:='';
end;
if edit1.text='113' then
begin
shape31.Visible:=false; shape32.visible:=false; shape33.Visible:=true;
edit1.Text:='';
end;
if edit1.text='121' then
begin
shape34.Visible:=true; shape35.visible:=false; shape36.Visible:=false;
edit1.Text:='';
end;
if edit1.text='122' then
begin
shape34.Visible:=false; shape35.visible:=true; shape36.Visible:=false;
edit1.Text:='';
end;
if edit1.text='123' then
begin
shape34.Visible:=false; shape35.visible:=false; shape36.Visible:=true;
edit1.Text:='';
end;
end;
end.
5. Hasil dan Pembahasan
a. Hasil
b. Pembahasan.
1) TImage adalah komponen visual yang digunakan untuk menampilkan gambar pada form. Komponen ini memungkinkan gambar dari berbagai format (seperti BMP, JPG, PNG, dan GIF) ditampilkan dalam aplikasi.
2) Tshape adalah salah satu komponen visual dalam Delphi yang digunakan untuk menggambar bentuk geometris sederhana seperti persegi panjang, lingkaran, elips, atau garis di dalam sebuah form atau container lainnya. TShape sangat berguna untuk membuat elemen visual yang sederhana.
3) TButton digunakan untuk membuat tombol (button) di antarmuka pengguna. TButton memungkinkan pengguna untuk memicu suatu aksi atau perintah ketika tombol tersebut diklik. Tombol sangat berguna dalam aplikasi Delphi untuk menjalankan berbagai macam perintah.
4) TEdit Dalam Delphi 8, fungsi t edit biasanya merujuk pada komponen TEdit, yang digunakan untuk membuat kontrol input teks di antarmuka pengguna.
6. Kesimpulan.
Dengan menggunakan Timage, Shape, Button dan Edit dapat berfungsi sebagai pembuatan aplikasi peta patroli sesuai dengan kondisi personel dilapangan aplikasi ini mempermudah danton dan danru untuk berkoordinasi melaporkan kondisi personel saat dilapangan apabila ada serangan dari musuh sehingga mengurangi kerugian personel saat dilapangan, serta mempercepat laporan situasi dilapangan.
7. Daftar Pustaka.








